home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gumby!wmichgw!873clifton
- From: 873clifton@gw.wmich.edu
- Newsgroups: comp.unix.questions
- Subject: Re: How do I get a particualr line of a file?
- Message-ID: <1992Nov23.155235.6561@gw.wmich.edu>
- Date: 23 Nov 92 15:52:35 EST
- References: <pec2.722467852@Isis.MsState.Edu> <1992Nov23.094227.1677@ericsson.se>
- Organization: Western Michigan University
- Lines: 24
-
- In article <1992Nov23.094227.1677@ericsson.se>, etxmesa@eos.ericsson.se (Michael Salmon) writes:
- > In article <pec2.722467852@Isis.MsState.Edu>,
- > pec2@ra.msstate.edu (Paul E. Carroll) writes:
- > |> This seems extremely simple, but I've run into the problem several times
- > |> and gotten stumped each time. So how do I view a particualr line of a
- > |> file? Head looks at the top, tail the end, cat - echo - more - or less-
- > |> look at the whole thing... but what if I want to see just line 30?
- > |> or JUST line 210? I'm stumped.
- >
- > This works for me:
- >
- > eos6c02 tmp 98 > cat -n /usr/etc/termcap | tail +210l | head -1
- > 210 :md=\E[1m:mr=\E[7m:mb=\E[5m:me=\E[m:\
- >
- > The cat -n is just to insert line numbers of course.
- >
-
- A slightly more efficient way would be:
-
- > nl -nln | grep '^201'
-
- /D
- --
- Douglas Clifton [99clifto@lab.cc.wmich.edu]
-