need help on unix

Philip Yzarn de Louraille yzarn at lhdsy1.chevron.com
Fri Jun 14 01:36:21 AEST 1991


In article <1991Jun11.004109.21966 at unixg.ubc.ca> wangf at unixg.ubc.ca (Frank Wang) writes:
>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.  
>

Find out how many lines you have "wc -l file"
Then create a file without the desired top or bottom lines
head -number file_name > new_file_name: to delete the bottom lines
tail -number file_name > new_file_name: to delete the top lines

where number is the number of lines you want to retain.
-- 
  Philip Yzarn de Louraille                 Internet: yzarn at chevron.com
  Research Support Division                 Unix & Open Systems
  Chevron Information & Technology Co.      Tel: (213) 694-9232
  P.O. Box 446, La Habra, CA 90633-0446     Fax: (213) 694-7709



More information about the Comp.unix.questions mailing list