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