Dec. 4th, 2008

rone: (Default)

I want to run a command that will give me the contents of a file, except for the last two lines.  I know that tail -2 filename will give me the last two lines of a file, and head -2 filename will give me the first two lines of a file.  Now, tail +2 filename will give me contents of a file, starting with line 2.  It's not a symmetrical option, but i can at least work with that.  However, the head command lacks this elegant mode; otherwise, i would infer that head +3 filename would give me what i want.  Is there a simple command that can do what i want?  I figure i can implement this in some fugly perl script, but that is not the damn point.

rone: (bofh)

I want to run a command that will give me the contents of a file, except for the last two lines.  I know that tail -2 filename will give me the last two lines of a file, and head -2 filename will give me the first two lines of a file.  Now, tail +2 filename will give me contents of a file, starting with line 2.  It's not a symmetrical option, but i can at least work with that.  However, the head command lacks this elegant mode; otherwise, i would infer that head +3 filename would give me what i want.  Is there a simple command that can do what i want?  I figure i can implement this in some fugly perl script, but that is not the damn point.

Profile

rone: (Default)
entombed in the shrine of zeroes and ones

December 2022

S M T W T F S
    123
45678910
11121314151617
18192021222324
252627282930 31

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 8th, 2025 08:21 pm
Powered by Dreamwidth Studios