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

Pete Krawczyk mongers at bsod.net
Fri Jul 29 11:23:19 PDT 2005


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



More information about the Chicago-talk mailing list