HomeLinux › Recursively Change Text in Files

Recursively Change Text in Files

Handy little Perl one liner example to find and replace text across multiple files/directories… as an example, to change every .php file recursively from the current directory, changing “find this” to “replace with this”:

find . -name '*.php' -print0 | xargs -0 perl -pi -e 's/find this/replace with this/g'

This post was written by

– who has written 17 posts on DotSlash.ca.
Plain old nerd.

Email  • Google + • Facebook

Share Button

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>