Globally replace text in several files

From Rosetta Code
Revision as of 14:30, 30 October 2010 by rosettacode>Markhobley (Initial page created)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The task is to replace every occuring instance of a piece of text in a group of text files with another one. For this task we want to replace the text "Goodbye London!" with "Hello New York!" for a list of files.

Perl

perl -pi -e "s/Goodbye London\!/Hello New York\!/g;" a.txt b.txt c.txt