delete first 100 lines from a file

Tags
sed, solaris, tail

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 11-15-2007
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.
# 2  
Old 11-15-2007
Code:
sed '1,100d' filename > newfile

sed would be faster than tail in my opinion
# 3  
Old 11-15-2007
if -i option is available in sed ( GNU sed )

use it for in-place modification

Code:
sed -i '1,100d' filename

# 4  
Old 11-15-2007
MySQL

Yes. Its really faster than the tail command.

Thanks Yogesh


Sarathi
# 5  
Old 06-09-2009
delete liines using sed.

Hi,

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.

Thanks.
David.
# 6  
Old 06-09-2009
sed -e "s/^SG//d"
# 7  
Old 06-09-2009
Quote:
Originally Posted by a2156z
sed -e "s/^SG//d"
Should be:

Code:
sed "/^SG/d" file

Regards
Login to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Similar Threads More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Delete 40 lines after every 24 lines from a file nehashine Shell Programming and Scripting 11 02-06-2014 09:43 AM
Delete lines in a file sonia102 UNIX for Dummies Questions & Answers 7 04-13-2013 08:15 AM
Delete first 100 lines from a BIG File unohu UNIX for Advanced & Expert Users 18 06-21-2012 01:22 PM
In a huge file, Delete duplicate lines leaving unique lines krishnix UNIX for Advanced & Expert Users 16 08-04-2011 05:47 AM
Delete some lines in a file ponmuthu UNIX for Advanced & Expert Users 5 07-28-2010 03:39 PM
How get only required lines & delete the rest of the lines in file reva UNIX for Dummies Questions & Answers 7 06-01-2010 03:58 AM
How to delete lines in a file that have duplicates or derive the lines that aper once necroman08 Shell Programming and Scripting 3 07-17-2009 06:07 AM
Delete same lines out of file. jzacsh UNIX for Dummies Questions & Answers 3 06-05-2009 12:22 PM
Please help to delete lines in a file naree Shell Programming and Scripting 6 05-22-2008 02:57 AM
delete n last lines of a file ncatdesigner Shell Programming and Scripting 7 05-17-2008 11:07 AM
delete first 100 lines rather than zero out of file thepurple Solaris 7 11-14-2007 01:35 PM
delete lines in a file su_in99 UNIX for Dummies Questions & Answers 20 03-08-2007 01:31 AM
Delete few lines from a file. Satadru Shell Programming and Scripting 3 08-19-2006 11:21 AM
how can I delete lines without actually going into the file TRUEST Shell Programming and Scripting 5 03-19-2002 05:12 AM
delete all lines in file strok UNIX for Dummies Questions & Answers 6 03-11-2002 10:27 PM
All times are GMT -4. The time now is 11:31 AM.

Unix & Linux Forums Content Copyright 1993-2018. All Rights Reserved.