Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command to delete first line from a text file 1

Status
Not open for further replies.

navink123

Programmer
Sep 2, 2003
21
US
I have a large text file. The first line of this file is the record count of that file. What would be the command to delete this line from the file. It is a very large file. So I cannot open it in vi and delete the line.
Thanks
Navin
 
Try this:

sed '1d' bigfile > bigfile.new


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
You can try something like this:
Code:
awk 'NR>1{print >FILENAME".tmp"}
END{system("mv "FILENAME".tmp "FILENAME)}' /path/to/file

Hope This Help
PH.
 
How about ex or ed.

e.g.

ed -s file << EOF
1
d
w
q
EOF



Cheers,
ND [smile]

bigoldbulldog@hotmail.com
 
tail +2 filename > newfile


I love deadlines. I like the whooshing sound they make as they fly by.

Douglas Adams
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top