2 ms·
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/
by scrame 10y ago
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.