stripping top line

stripping top line

Post by Tom Christianse » Sun, 31 Oct 1993 01:01:22




:
:>Mike> how do you remove the top line from a file?  i know how to get
:>Mike> the top line with head, but i'm looking to remove it.  To tail
:>Mike> everything but the top line can't work because the file will be
:>Mike> of different lengths (unless there is a command to see how many
:>Mike> lines a file is)
:>
:
:in awk/nawk
:
:
:        nawk '{ if(++i != 1) print $0}' your_file

        awk 'NR > 1'
        sed 1d
        tail +2

are all simpler.

--tom
--

      "Will Hack Perl for Fine Food and Fun"
        Boulder Colorado  303-444-3212

 
 
 

stripping top line

Post by Jeremy Mathe » Sun, 31 Oct 1993 02:24:08




>:
>:        nawk '{ if(++i != 1) print $0}' your_file

>    awk 'NR > 1'
>    sed 1d
>    tail +2

>are all simpler.

Yup.  Bill's solution is certainly in the "Let's make this as complicated
and 3GLish as we possibly can" category.

************************************************************************
My version of Shakespeare, as applied to traffic safety:
        First thing we do is kill all the cabdrivers!


          hundreds, if not thousands, of dollars, every time he posts -
************************************************************************
rwvpf wpnrrj ibf ijrfer

 
 
 

stripping top line

Post by Kim Chr. Mads » Sun, 31 Oct 1993 01:04:46



>in awk/nawk
>        nawk '{ if(++i != 1) print $0}' your_file

Too cumbersome, just do a

        awk 'NR>1'

--

 
 
 

stripping top line

Post by Mike Schien » Sun, 31 Oct 1993 04:44:39



>>this is pretty simple (i hope)
>>how do you remove the top line from a file?
>>actual syntax would be very appreciated.
>>Thanx,
>>Mike.
>>PliNKo.

How about:
sed 1d file > /tmp/file
mv /tmp/file file

I think that's pretty simple.

I had to cut out a lot of the previous post and a reply and add in this stupid line
because our news reader wants me to reply with more new text than existing text. Good
idea in theory, but a burden at this point.


Hughes SBRC, Santa Barbara, CA                            (805)562-7466

 
 
 

stripping top line

Post by Mark Allm » Wed, 03 Nov 1993 07:33:16



Quote:>this is pretty simple (i hope)

>work because the file will be of different lengths (unless
>there is a command to see how many lines a file is)

the 'wc' (word count) command will tell you how long a file is with
    wc -l filename

allman

--

                 Mark Allman - Ohio University Computer Science

        All programmers are playwrights, and all computers lousy actors.