News for hackers. Stuff that matters.
Re:Useful Perl one-liners (2013) by scrame on Tuesday November 29, 2016 @03:49PM (#13066145)
The -i switch takes an optional string that creates a backup of the file with that extension. To use your example (with zsh blobbing):

   perl -p -i.bak -e 's/foo/bar/gi' **/*.txt
Recursively replaces foo with bar on every .txt file in a hierarchy and saves the original file with a .bak extension, along with the in-place edit in the original.

There are no comments on this comment yet.