Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!sdd.hp.com!wuarchive!uunet!lhdsy1!yzarn From: yzarn@lhdsy1.chevron.com (Philip Yzarn de Louraille) Newsgroups: comp.unix.questions Subject: Re: need help on unix Message-ID: <949@lhdsy1.chevron.com> Date: 13 Jun 91 15:36:21 GMT References: <1991Jun11.004109.21966@unixg.ubc.ca> Distribution: na Organization: Chevron Oil Field Research, La Habra, CA. Lines: 17 In article <1991Jun11.004109.21966@unixg.ubc.ca> wangf@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@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