The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
read list of filenames from text file, archive, and remove fxvisions Shell Programming and Scripting 5 03-20-2007 06:56 PM
how to remove ^M from windows text file in unix pragy1999 Shell Programming and Scripting 1 04-13-2006 07:04 AM
Remove header(first line) and trailer(last line) in ANY given file madhunk Shell Programming and Scripting 2 03-13-2006 12:36 PM
Insert a line as the first line into a very huge file shriek UNIX for Advanced & Expert Users 3 03-08-2005 10:22 PM
Huge (repeated Entry) text files axl SUN Solaris 4 07-16-2004 04:05 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 06-20-2007
Registered User
 

Join Date: Jun 2007
Posts: 3
Exclamation How to remove FIRST Line of huge text file on Solaris

i need help..!!!!

i have one big text file estimate data file size 50 - 100GB with 70 Mega Rows.
on OS SUN Solaris version 8

How i can remove first line of the text file.

Please suggest me for solutions.

Thank you very much in advance
Reply With Quote
Forum Sponsor
  #2  
Old 06-20-2007
Registered User
 

Join Date: Jun 2007
Posts: 3
Unhappy

i tried to use :

$ head -1 bigfile.txt > bigfile2.txt
$

But line 1 of bigfile.txt don't removed from bigfile.txt. It's just copy first line from bigfile.txt to bigfile2.txt Only.

T_T
Reply With Quote
  #3  
Old 06-20-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Personally I would write a small C program that would

1. find the length of the first line

2. do repetative read/writes to shuffle the data up

3. use ftruncate to remove the length from the end of the file

However I would also recommend you back this file up.

If you know how many lines there actually are....

Code:
wc -l <bigfile.txt
then if there are 70, do the following...

Code:
tail -69 <bigfile.txt >bigfile2.txt
Reply With Quote
  #4  
Old 06-20-2007
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,619
I would try:
sed 1d < bigfile.txt >bigfile2.txt
Reply With Quote
  #5  
Old 06-20-2007
Registered User
 

Join Date: Jun 2007
Posts: 3
Thumbs up thk

Thank you very much krab. ^^

i can solved it ^^
Reply With Quote
  #6  
Old 06-23-2007
Registered User
 

Join Date: Feb 2007
Location: Bangalore
Posts: 105
Quote:
Originally Posted by madoatz View Post
i need help..!!!!

i have one big text file estimate data file size 50 - 100GB with 70 Mega Rows.
on OS SUN Solaris version 8

How i can remove first line of the text file.

Please suggest me for solutions.

Thank you very much in advance
If you know the pattern of first line or some word which does not repeat else where in the file,then you can use grep command.

cat filename | grep -v 'pattern' > file_temp
mv file_temp > filename
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:50 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0