grep -rl matchstring somedir/ | xargs sed -i 's/string1/string2/g'

Ok so yeah. This uses grep to find a string in files in a directory and then executes sed to change a string in all of them. A beautiful super simple command…thx vasir!

Blog Logo

Mario Loria


Published

Image

./scriptthe.net

Because 127.0.0.1 gets old after a while.

Back to Overview