Hello guys,
I need help in globally replacing a string 'string1' with 'string2' in several files in a directory. In fact, also in all directories under it.
Can anyone help me...
Thanks
Hello guys,
I need help in globally replacing a string 'string1' with 'string2' in several files in a directory. In fact, also in all directories under it.
Can anyone help me...
Thanks
find /directory -type -f | \
while read file
do
sed 's/string1/string2/g' "$file" > ./tmpfile
mv ./tmpfile "$file"
done
start with this - it changes string1 -> string2 in every file in /directory and all of the sub-directories of /directory
Another way using perl :
find /directory -type -f | xargs perl -p -i -e 's/string1/string2/g'
Thank you verymuch, it's working !!!