bulk search and replace with sed

July 26, 2010 | In Linux | No Comments

Kurt writes:

I’ve got a text input string in unix that I want to parse and replace all of the following characters [\^$.|?*+(){} with the same character preceded by an \.

(I am trying to backslash escape all the special characters used by grep before I feed the string into grep.  Don't ask - not my original code.)

For example, "this \is an $xample" would become "this \\is an \$xample".

What would be the easiest way to do this?

I got this to work : sed -e "s/\([[\^$.|?*+(){}]\)/\\\\\1/g” test.txt

hope this helps someone.

Dell Inspiron Mini 10 SSD Swap

March 24, 2010 | In Linux, Other Tech | No Comments

Youtube has lots of howto’s to show how to crack these various mini’s .

Dell Inspiron Mini 9 Upgrade Flash Hard Drive

Every little machine has its own little trick to opening the case….

dell mini replace hard drive how

Next Page »

Powered by WordPress RSS XMLRSS Feed - Syndicate this Site and comments feed
linux GNUpowered by Apache tomcatMySQL ABPHP - The Language the Web Runs on

^Top^ Gare CalhounGare CalhounGare CalhounGare CalhounGare Calhoun