From 3d5efcd558837ed35c44a7a14c2efc34bb0851e2 Mon Sep 17 00:00:00 2001 From: tianci li Date: Sun, 16 Jan 2022 14:40:25 +0800 Subject: [PATCH] Simple small fix --- docs/gemstones/perl_search_replace.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/gemstones/perl_search_replace.md b/docs/gemstones/perl_search_replace.md index 829c6de247..5d83d93166 100644 --- a/docs/gemstones/perl_search_replace.md +++ b/docs/gemstones/perl_search_replace.md @@ -12,6 +12,7 @@ To search for and replace a particular string across multiple files in a direct ``` perl -pi -w -e 's/search_for/replace_with/g;' ~/Dir_to_search/*.html ``` + For a single file that might have multiple instances of the string, you can specify the file: ``` @@ -24,12 +25,12 @@ This command uses vi syntax for search and replace to find any occurrence of a s |Option | Explanation | |-------|---------------------------------------------------------------| -| p | places a loop around your script | -| i | edit file in place | -| w | prints out warning messages in case something goes wrong | -| e | allows a single line of code entered on the command line | -| s | specifies search | -| g | specifies to replace globally, in other words all occurrences | +| -p | places a loop around your script | +| -i | edit file in place | +| -w | prints out warning messages in case something goes wrong | +| -e | allows a single line of code entered on the command line | +| -s | specifies search | +| -g | specifies to replace globally, in other words all occurrences | ## Conclusion