[Chicago-talk] delete the first line in a text file.

Jim Thomason thomasoniii at gmail.com
Fri Jul 29 11:32:42 PDT 2005

Surely we can't let such an obvious challenge go answered by only one
response! We Perl guys just love to come up with excessive excessively
short ways to do things.

perl -ni -e 'print unless 1..1' file.txt

God, I'm so turned on right now.


On 7/29/05, Pete Krawczyk <mongers at bsod.net> wrote:
> Subject: [Chicago-talk] delete the first line in a text file.
> From: Richard Reina <richard at rushlogistics.com>
> Date: Fri, 29 Jul 2005 11:08:11 -0700 (PDT)
> }Anyone know the easiest way remove the 1st line in a
> }text file.  I was thinking it should be something
> }like:
> I personally would use:
>   # perl -ni.bak -e'print if ++$a > 1;' filename.txt
> which will create a filename.bak with the original file, and a
> filename.txt with the first line missing.  (You can shorten to
> "-ni -e" if you don't need a backup.)
> -Pete K
> --
> Pete Krawczyk
>   mongers at bsod dot net
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk

More information about the Chicago-talk mailing list