Hi
I have to replace value data1 by data2 where existing inside all the files on directory and subdirectories /data/bin
Is it working using find and sed in combination. Does sed also working looking in directories?
would be nice if you have any suggestions.
Thanks Reto
system
July 5, 2007, 11:39am
2
man sed
will give you your answer
I have checked the man pages already.
I'm using now a find, move everything to a file:
find /app/oracle/product -type f -exec grep -l data1 {} \; > data1_files.txt
Then I will loop that file using a sed command.
I thought this would be possible in one step, but probably not.
Regards Reto
for mFile in `find /app/oracle/product -type f -exec grep -l data1 {} \;`
do
echo "At "`date`" working with file = "$mFile
sed 's/data1/data2/g' $mFile > $$Temp
mv $$Temp $mFile
done
thanks a lot shell_life for your statement!
I will test it asap.
Regards Reto
Thanks a lot shell_life - your script is perfect!!
Fantastic!!
Regards Reto