Operating System - Linux
1753797 Members
7651 Online
108805 Solutions
New Discussion юеВ

Re: Stripping 2 lines from the top of a text file.

 
rmueller58
Valued Contributor

Stripping 2 lines from the top of a text file.

I am trying to strip the top two lines from a data file from with in script and put the output to a second file.

I need a refresher on a quick sed or awk command to strip Line 1 and Line 2 from a variable length file.

Any thoughts appreciated.

4 REPLIES 4
rmueller58
Valued Contributor

Re: Stripping 2 lines from the top of a text file.

Disregard, found my notes.

sed '1,2d' file1.ext > goodfile.ext

James R. Ferguson
Acclaimed Contributor

Re: Stripping 2 lines from the top of a text file.

Hi:

# sed -ne '1,2p' file > file_of_2

Regards!

...JRF...

rmueller58
Valued Contributor

Re: Stripping 2 lines from the top of a text file.

Jim, Thanks.. I found it.

Have another issue, will post a new question..
Dennis Handly
Acclaimed Contributor

Re: Stripping 2 lines from the top of a text file.

To skip the first 2 lines of a file you can simply use tail:
$ tail +3 file1.ext > goodfile.ext