nix, shell, perl, php, mysql and mac os x tips and tricks

Wednesday, November 12, 2008

search and replace text in files on the command line

find . -name "*.php" -print | xargs sed -i 's/foo/bar/g'
use '-maxdepth 1' before -name if you want to restrict to current directory