Advertisement

11.14.2008 at 04:32PM PST, ID: 23907038 | Points: 500
[x]
Attachment Details

How do I write this in BASH script? Escape Function for Sed

Asked by Octalys in Bourne-Again Shell (bash)

Hi,

I am doing a lot of  find / -name "*" -type f -exec sed -i 's/STRING1/STRING2/' {} \;

But I am going crazy because everytime I need to manually escape chars like / and & in STRING1 and STRING2. Is there a way to write it or perhaps to use a extra function, so I dont have to escape strings like this - > Hosted for free by <a href="http:\/\/www.fleeforum.com" target="_blank">fleeforum.com<\/a> \&copy;  

Thank you.Start Free Trial
 
Keywords: How do I write this in BASH script? Es…
 
Loading Advertisement...
 
[+][-]11.14.2008 at 07:49PM PST, ID: 22965593

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 - Hierarchy / EE_QW_3_20080625