Thursday, August 30, 2007
Tuesday, August 28, 2007
Search and Replace Inline many files
One line way if you have perl to search and replace instances of a certain text with something else. Don't forget to escape special characters w/ a backslash (\).
perl -pi -e 's/find/replace/g' *.txt
Or, to change matching files in a hierarchy:
find . -name '*.txt' |xargs perl -pi -e 's/find/replace/g'
perl -pi -e 's/find/replace/g' *.txt
Or, to change matching files in a hierarchy:
find . -name '*.txt' |xargs perl -pi -e 's/find/replace/g'
Subscribe to:
Posts (Atom)