[Chicago-talk] removing line from file.

Pete Krawczyk mongers at bsod.net
Wed Mar 9 11:22:49 PST 2005


Following up to myself...

}perl -ni.bak -e 'print unless 1..4' file1 file2 file3

You can only use file1 in this instance, since $. is cumulative and 
doesn't reset on a new file.

For things that don't rely on a counter (e.g. a search-and-replace), the 
multiple-file version works just fine.

"perldoc perlrun" for more details on the -i switch.

-Pete K
-- 
Pete Krawczyk
  mongers at bsod dot net



More information about the Chicago-talk mailing list