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




Because gets old after a while.

Back to Overview