Deleting the first three lines of a file

Asked by avkapur

Hi, just need to know how to delete the first three lines of a file and then shift the rest of the file upwards so there is no space from the top. The first few lines look like this:
==> xx00 <==
Clover: Cis-eLement OVERrepresentation
Compiled on Jul 10 2008
==> xx01 <==
>ENSMUSG00000023800
 Hoxb1(1) 177 - 186 - ccacccatct 10.2

==> xx02 <==
>ENSMUSG00000024087
 Hoxb1(1) 1576 - 1585 + agatgactgg 6.55

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gnome-terminal Edit question
Assignee:
No assignee Edit question
Solved by:
W. Prins
Solved:
Last query:
Last reply:
Revision history for this message
Deepak Mishra (dpux) said :
#1

 sed '1d;2d;3d' file > new_file

Revision history for this message
Trygve Vea (trygve-vea-gmail) said :
#2

The command:

sed -i '1,3d' filename

should do the trick.

Hope it helps :)

Regards, Trygve

Revision history for this message
Best W. Prins (wprins) said :
#3

Backup your file then try this:

     sed -i '1,3d' filename.txt

-i means "edit in place"

'1,3' means select lines 1 to 3
'd' means delete selection.

Revision history for this message
avkapur (avkapur) said :
#4

Thanks, really appreciate it.