I have 70 files and want to replace string1 with string2. How can i do that?.
Thanks
I have 70 files and want to replace string1 with string2. How can i do that?.
Thanks
man sed
Have you attempted to solve this problem at all? Do you have a script fragment to show us?!
To help you out - (i'd) use sed in a for loop to iterate through the files. But that's all you're getting 'til you post some of your efforts!
Cheers
ZB
I want to replace 20040915 with 20040916.
You still haven't posted your work so far.
However, benefit of the doubt granted that this isn't some kind of homework problem, then a script such as
#!/bin/sh
for file in /path/to/files/*
do
sed 's/20040915/20040916/g' $file > $file.new
rm $file
mv $file.new $file
done
exit 0
If you want to keep the "old" copies of the files too, just remove the "rm" and "mv" lines from the script.
Cheers
ZB
Its working. Thanks ZB.