home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!ftpbox!news.acns.nwu.edu!zaphod.mps.ohio-state.edu!hobbes.physics.uiowa.edu!moe.ksu.ksu.edu!ux1.cso.uiuc.edu!sdd.hp.com!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!caen!nic.umass.edu!news.amherst.edu!twpierce
- From: twpierce@unix.amherst.edu (Tim Pierce)
- Subject: Re: Getting the nth line of a file
- Message-ID: <C1HyrJ.FLL@unix.amherst.edu>
- Organization: Elitist Usenet Administrators, Stuff and Nonsense Division
- References: <1993Jan25.163208.11697@atlantis.uucp> <1993Jan26.151133.18029@atlantis.uucp> <1993Jan26.232708.10878@odin.corp.sgi.com>
- Date: Wed, 27 Jan 1993 05:18:54 GMT
- Lines: 24
-
- In article <1993Jan26.232708.10878@odin.corp.sgi.com> vidya@akshay.csd.sgi.com (Vidya Alankar) writes:
-
- >In article <1993Jan26.151133.18029@atlantis.uucp>, aaron@atlantis.uucp writes:
- >
- >|> > I'm not sure if
- >|> > sed quits after printing the Nth line, which is really what you want
- >|> > for speed; the sed man page always confuses me.
-
- The sed man page isn't really that bad. Just keep remembering Indiana
- Jones: "Only the penitent will pass."
-
- >It does read the full file. I do not know enough about sed to say if they
- >is a way to stop after the Nth line. The awk command above does just this.
-
- sed -n 'Npq' (where N is the number of the line to print).
-
- This is infinitely more desirable than any of the other sed solutions
- listed. Since the command contains no metacharacters or spaces, I
- doubt you need quotes.
-
- --
- ____ Tim Pierce /
- \ / twpierce@unix.amherst.edu / Rocks say goodbye.
- \/ (BITnet: TWPIERCE@AMHERST) /
-