Tomasz Korwel
programmer, administrator, engineer – my everyday fights with reality

October 18th, 2011

Find and replace within multiple files

Posted by tomasz in tips & tricks vault

I can’t remember how many times I needed this line recently. I also could never remember it (hm… do you see a pattern here?). So here it is for future reference:

find . -name "*.php" -print | xargs sed -i '.backup' 's/foo/bar/g'

It’s pretty much self explanatory. If I could only make it stick in my brain.

Leave a reply

:mrgreen: :neutral: :twisted: :shock: :smile: :???: :cool: :evil: :grin: :oops: :razz: :roll: :wink: :cry: :eek: :lol: :mad: :sad:

ZEND Certified Engineer
Listed on BlogShares

Tomasz Korwel is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com