in reply to how to delete part of the line?

perl -ple's/^line\d+=//' infile > outfile

Use double quotes in Windows.

Update: Oops, I forgot about the slashes. That should be

perl -nle's/^line\d+=//; push @l,$_; END { $,=q{/}; print @l }' infile + > outfile

Not nearly as nice a one-liner :(

Replies are listed 'Best First'.
Re^2: how to delete part of the line?
by grizzley (Chaplain) on May 22, 2009 at 06:33 UTC

    Than maybe two simple one-liners?

    perl -ple's/^line\d+=//' infile | perl -p0e 's!\n!/!g' > outfile
    or
    perl -ple's/^line\d+=//' infile | perl -p0e 's!\s+$!! ; s!\n!/!g' > ou +tfile
    if end of the output has any meaning. Hmm, seems there is no beauty, too.

      No good. Those replace the trailing newline with a "/". If that was desirable, the following would suffice:

      perl -pl57e"s/^line\d+=//" infile > outfile
Re^2: how to delete part of the line?
by yskmonk (Initiate) on May 21, 2009 at 22:33 UTC
    where do I insert this in my code?
      That's the code in its entirety.