All of the interesting technological, artistic or just plain fun subjects I'd investigate if I had an infinite number of lifetimes. In other words, a dumping ground...

Monday, 7 April 2008

substitute text in multiple files at once on Linux

find . -name "*.c*" | xargs grep -l 'foo' | xargs /bin/sed -i -e 's/foo/bar/g'
find . -name "*.h" | xargs grep -l 'foo' | xargs /bin/sed -i -e 's/foo/bar/g'

From http://lists.freebsd.org/pipermail/freebsd-questions/2005-January/074032.html

No comments:

tim's shared items

Add to Google Reader or Homepage