easy way to change string in multiple files?

Gerald Combs gerald at ethereal.com
Sat Oct 5 23:59:45 CDT 2002


On 5 Oct 2002, Chris Hoelscher wrote:

> Looking for an easy way to change 'string.a' to 'string.b' in a set of
> files within one directory.  I know I can find all the lines with grep,
> but is there a command I can pipe the grep to to change the files?

    perl -pi.bak -e 's/string.a/string.b/g;' *

The perlrun(1) man page provides a detailed explanation.




More information about the Kclug mailing list