Hi, I'm a relative newb to Unix, and I'm looking for a bit of help on grep (or sed or something like that)
I want to search a whole bunch of files for the string "$cal" and replace it with the string "$osa". I then want to save all the altered files.
How would I do this?
By the way, all the files are in the same directory or a subdirectory thereof. I'm running Windows 2K, Exceed 6.1.0.0, ksh, and the server runs SunOS 5.8.
Ygor
March 12, 2004, 4:52am
3
This can be done using sed and a loop...
for file in files*
do
cp $file $file.bk &&\
sed 's/\$cal/\$osa/g' $file.bk > $file &&\
rm $file.bk
done
Or in perl...
perl -pi -e 's/\$cal/\$osa/g' files*