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`;
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\
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:
>
>
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
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