This is always a nice snippet to have around:

for i in `find . -name '*.ext'`; do perl -pi -e 's/foo/bar/' "$i"; done

It searches the current directory and all children recursively and replaces “foo” with “bar” in all files with names matching ”*.ext”.

1 Response to “Search and replace in multiple files”

Sorry, comments are closed for this article.