From 8b85207f357beb6c9ef0d2e14d85787b815386b0 Mon Sep 17 00:00:00 2001 From: morrme Date: Sat, 15 Apr 2017 10:48:00 -0500 Subject: [PATCH] perl: add pie example per issue #1239 --- pages/common/perl.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pages/common/perl.md b/pages/common/perl.md index 9f574b9b2..8c1f5ce69 100644 --- a/pages/common/perl.md +++ b/pages/common/perl.md @@ -21,3 +21,11 @@ - Run a Perl script in debug mode, using `perldebug`: `perl -d {{script.pl}}` + +- Replace all occurrences of a string in a file with another string, overwriting the file in-place: + +`perl -p -i -e 's/{{find}}/{{replace}}/g' {{filename}}` + +- Same, saving an unmodified copy of the original file with a different extension: + +`perl -p -i'.old' -e 's/{{find}}/{{replace}}/g' {{filename}}`