need help on unix

Guy Harris guy at auspex.auspex.com
Mon Jun 17 10:26:21 AEST 1991


>Does anyone out there know how to delete the first few lines or the last 
>few lines from a file without evoke a editor?  The reason is the file is
>too large to be edited.  

In that case, beware of suggestions to use "tail" to delete the first
few lines, such as some suggestions others have made; "tail" buffers up
a *limited* amount of text, and if you have a 500,000 line file and you
want to delete the first 5 lines, the remaining 499,995 lines are quite
unlikely to fit in "tail"s buffer, given that the file is too large to
be fed to your editor.

"sed" can do a better job; if you want to remove the first N lines, try
"sed -n 'N-1,$p'", where "N-5" needs to be computed and literally
inserted in the command. 



More information about the Comp.unix.questions mailing list