Mack,
He wants to discard the first and last 10,000 lines. head and tail
write them to stdout.
Edmund R. MacKenty wrote:
On Tuesday 04 September 2007 14:21, Scully, William P wrote:
What's the best technique for trimming a file? IE: I have file
"/var/log/toolarge". What's the fastest technique to discard
- The first 10,000 records?
head -n 10000 /var/log/toolarge > /var/log/toolarge.$$ &&
mv /var/log/toolarge.$$ /var/log/toolarge
- The last 10,000 records?
tail -n 10000 /var/log/toolarge > /var/log/toolarge.$$ &&
mv /var/log/toolarge.$$ /var/log/toolarge
And as a bonus, since files are stream oriented, what's the fastest
technique for finding out how many records are in the file?
wc -l /var/log/toolarge
All of these assume that your "record separator" is a newline character.
- MacK.
-----
Edmund R. MacKenty
Software Architect
Rocket Software, Inc.
Newton, MA USA
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
--
Rich Smrcina
VM Assist, Inc.
Phone: 414-491-6001
Ans Service: 360-715-2467
rich.smrcina at vmassist.com
http://www.linkedin.com/in/richsmrcina
Catch the WAVV! http://www.wavv.org
WAVV 2008 - Chattanooga - April 18-22, 2008
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390