Return to Snippet

Revision: 10300
at December 17, 2008 00:22 by sanjivarunsahayamhotmailcom


Initial Code
perl -pi -w -e 's/search/replace/g;' files

    -e means execute the following line of code.
    -i means edit in-place
    -w write warnings
    -p loop

eg.

perl -pi -w -e 's/today/tomorrow/g;' dates*.txt

Initial URL

                                

Initial Description
Replace all the occurrences of a string with a replacement in the supplied files.

Initial Title
Search and replace with perl

Initial Tags
Bash, search, replace, perl

Initial Language
Bash