Given a text file of unknown length, how can I read, for example all but the first 2 lines of the file? I know tail
will give me the last N lines, but I don't know what N is ahead of time.
So for a file
AAAA
BBBB
CCCC
DDDD
EEEE
I want
CCCC
DDDD
EEEE
And for a file
AAAA
BBBB
CCCC
I'd get just
CCCC
Try
sed 1,2d
. Replace 2 as needed.Assuming your version of tail supports it, you can specify starting the tail after X lines. In your case, you'd do 2+1.