Hi,
If you want to search and replace specific string from multiple file recursively then below command is useful for it :
Linux Command:
# grep -rl "string1" * -R | xargs sed -i 's/string1/string2/g'
Here above command is combination of 'grep' and 'sed',
grep : Command will search for "string1" and returns file-name where string1 found
sed : will replace the "string1" to "string2"
string1 : old string
string2 : New string
You can watch the above process on youtube also...
http://youtu.be/GcopukZz3io
If you want to search and replace specific string from multiple file recursively then below command is useful for it :
Linux Command:
# grep -rl "string1" * -R | xargs sed -i 's/string1/string2/g'
Here above command is combination of 'grep' and 'sed',
grep : Command will search for "string1" and returns file-name where string1 found
sed : will replace the "string1" to "string2"
string1 : old string
string2 : New string
You can watch the above process on youtube also...
http://youtu.be/GcopukZz3io
5 comments :
Good tip; thanks
However, what if the string to be replaced contains a " ?
Something like this:
href="./someaddress.com_files
Plz give me old and new string for replacement
Plz give me old and new string for replacement
Hello, awsome.
I need to change the text "/cess/" to "/cessV2/" . what should i do?
Thanks
replace / to |
Post a Comment