home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!warwick!warwick!not-for-mail
- From: maupb@csv.warwick.ac.uk (Mr J L Saunders)
- Newsgroups: comp.unix.questions
- Subject: Re: How do I get a particualr line of a file?
- Message-ID: <1epg3hINN5ae@violet.csv.warwick.ac.uk>
- Date: 23 Nov 92 02:36:33 GMT
- References: <pec2.722467852@Isis.MsState.Edu> <1992Nov22.235943.13501@umbc3.umbc.edu>
- Organization: Computing Services, University of Warwick, UK
- Lines: 28
- NNTP-Posting-Host: violet.csv.warwick.ac.uk
-
- In article <1992Nov22.235943.13501@umbc3.umbc.edu> rouben@math9.math.umbc.edu (Rouben Rostamian) writes:
-
- %To print line 30:
- %sed -n 30p filename
- %
- %To print lines 30 to 35:
- %sed -n 30,35p filename
- %
- %--
- %Rouben Rostamian
-
- Yep! I should have thought of sed before resorting to awk!
-
- For tcsh and csh users, to make life even simpler do:
- alias fline "sed -n \!:1p \!:2"
-
- and then to get line 7 of file foo, type:
- fline 7 foo
-
- and to get lines 30 to 35 type:
- file 7,35 foo
-
- Cheers,
- Jason
- --
- Jason L Saunders [ RouE ]
- email: maupb@csv.warwick.ac.uk
- snail: Warwick Business School, University of Warwick, Coventry CV4 7AL, UK
-