Click to See Complete Forum and Search --> : Unix all file replace


rayhab
10-29-2007, 03:25 PM
I hope i've started this in the correct thread.. anyways..

I am trying to do a text replace in unix to all files in a directory

I've tried this

sed -e 's/include\(\"connect/bob' -i *.php

however it gives an error
sed: -e expression #1, char 24: unterminated `s' command

I'm sure it has to do with the \(\" part..

Basically i want to replace all include("connect with bob...

And there are too many files to do it manually...

I have no experience with unix.. but i heard i can also use GREP?

Any help would be appreciated.

BrainDonor
10-30-2007, 01:08 PM
There's a product named UltraEdit that you can download as a trial. It has a built-in "search and replace in files" function.

rayhab
10-30-2007, 01:09 PM
For those interested, i found the solution.

I was missing a / at the end

So it should be
sed -e 's/include\(\"connect/bob/' -i *.php

BrainDonor
10-30-2007, 01:30 PM
Glad you got it to work.