AIX Tip of the Week

AIX Tip of the Week: Perl Trick to Edit Multiple Files with One Command

Audience: AIX Users

Date: January 20, 2001

Here's a Perl trick that can simplify editing multiple files to make the same change. To illustrate, the following command changes all occurances of "LOTUS" to "IBM" in all files in the current directory.

$ perl -p -i -e "s/LOTUS/IBM/g" *

As with any global change command, be sure to back up the files before running the command.



w3.ibm.com About IBM Help Search Feedback www.ibm.com

Bruce Spencer,
baspence@us.ibm.com

January 20, 2001