RE: Modifying/Deleting lines in a file

2001-05-24 Thread Jeff Pinyan
On May 24, David Blevins said: >So, as far as editing files in a subroutine of a script, there does not seem >to be an easier or more performant way? > >Would it be performant to call the perl command as a subprocess, as in: > >`perl -ni -e 'print unless /I'm a bad line, delete me\./' thefile`;

RE: Modifying/Deleting lines in a file

2001-05-24 Thread Brett W. McCoy
On Thu, 24 May 2001, David Blevins wrote: > So, as far as editing files in a subroutine of a script, there does not seem > to be an easier or more performant way? > > Would it be performant to call the perl command as a subprocess, as in: > > `perl -ni -e 'print unless /I'm a bad line, delete me\

RE: Modifying/Deleting lines in a file

2001-05-24 Thread David Blevins
So, as far as editing files in a subroutine of a script, there does not seem to be an easier or more performant way? Would it be performant to call the perl command as a subprocess, as in: `perl -ni -e 'print unless /I'm a bad line, delete me\./' thefile`; David > Timothy Kimball wrote: > >

Re: Modifying/Deleting lines in a file

2001-05-24 Thread Brett W. McCoy
On Thu, 24 May 2001, David Blevins wrote: > Thanks to everyone for the great input on my last question. Here's another. > > There has to be a better way to modify/delete lines in a file than this. > > my $filename = "thefile"; > my $lineToDelete = "I'm a bad line, delete me."; > > op

Re: Modifying/Deleting lines in a file

2001-05-24 Thread Timothy Kimball
David Blevins wrote: : There has to be a better way to modify/delete lines in a file than this. Time for a one-liner: perl -ni -e 'print unless /I'm a bad line, delete me\./' thefile -n loops through the lines of thefile, but doesn't print them unless you ask -i edits thefile in place -e mea