delete first 100 lines from a file

Login or Register to Reply

Thread Tools Search this Thread
# 1  
Question delete first 100 lines from a file

I have a file with 28,00,000 lines of rows in this the first 80 lines will be chunks .

I want to delete the chunks of 80 lines. I tried tail -f2799920 filename.
is there any efficient way to do this.

Thanks in advance.
# 3  
if -i option is available in sed ( GNU sed )

use it for in-place modification

sed -i '1,100d' filename

# 5  
delete liines using sed.


I am trying to delete all lines in a file which starts with SG.

Command : sed -e "s/^SG/d/" bcpfile > test1.

But the above command just replaces 'SG' with 'd'. Please suggest the correct command to delete the whole line.

# 6  
sed -e "s/^SG//d"
# 7  
Originally Posted by a2156z
sed -e "s/^SG//d"
Should be:

sed "/^SG/d" file

Login or Register to Reply

Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Delete first 100 lines from a BIG File
Hi, I need a unix command to delete first n (say 100) lines from a log file. I need to delete some lines from the file without using any temporary file. I found sed -i is an useful command for this but its not supported in my environment( AIX 6.1 ). File size is approx 100MB. Thanks in...... UNIX for Advanced & Expert Users
UNIX for Advanced & Expert Users
In a huge file, Delete duplicate lines leaving unique lines
Hi All, I have a very huge file (4GB) which has duplicate lines. I want to delete duplicate lines leaving unique lines. Sort, uniq, awk '!x++' are not working as its running out of buffer space. I dont know if this works : I want to read each line of the File in a For Loop, and want to...... UNIX for Advanced & Expert Users
UNIX for Advanced & Expert Users
How get only required lines & delete the rest of the lines in file
Hiiii I have a file which contains huge data as a.dat: PDE 1990 1 9 18 51 28.90 24.7500 95.2800 118.0 6.1 0.0 BURMA event name: 010990D time shift: 7.3000 half duration: 5.0000 latitude: 24.4200 longitude: 94.9500 depth: 129.6000 Mrr: ...... UNIX for Dummies Questions & Answers
UNIX for Dummies Questions & Answers
How to delete lines in a file that have duplicates or derive the lines that aper once
Input: a b b c d d I need: a c I know how to get this (the lines that have duplicates) : b d sort file | uniq -d But i need opossite of this. I have searched the forum and other places as well, but have found solution for everything except this variant of the problem.... Shell Programming and Scripting
Shell Programming and Scripting
delete first 100 lines rather than zero out of file
Hi experts, in my solaris 9 the file- /var/adm/messeages growin too first. by 24 hours 40MB. And always giving the below messages-- bash-2.05# tail -f messages Nov 9 16:35:38 ME1 last message repeated 1 time Nov 9 16:35:38 ME1 ftpd: wtmpx /var/adm/wtmpx No such file or directory Nov 9...... Solaris