home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / unix / question / 13877 < prev    next >
Encoding:
Text File  |  1992-11-23  |  1.3 KB  |  35 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uwm.edu!ux1.cso.uiuc.edu!krisk
  3. From: krisk@ux1.cso.uiuc.edu (Kris Klindworth)
  4. Subject: Re: How do I get a particualr line of a file?
  5. Message-ID: <By6wFz.3no@ux1.cso.uiuc.edu>
  6. Organization: University of Illinois at Urbana
  7. References: <pec2.722467852@Isis.MsState.Edu> <1992Nov23.094227.1677@ericsson.se> <1992Nov23.155235.6561@gw.wmich.edu>
  8. Date: Mon, 23 Nov 1992 22:14:08 GMT
  9. Lines: 24
  10.  
  11. pec2@ra.msstate.edu (Paul E. Carroll) writes:
  12. > This seems extremely simple, but I've run into the problem several times
  13. > and gotten stumped each time.  So how do I view a particualr line of a 
  14. > file?  Head looks at the top, tail the end, cat - echo - more - or less-
  15. > look at the whole thing... but what if I want to see just line 30?
  16. > or JUST line 210?  I'm stumped.
  17.  
  18.  
  19. Sounds like a job of sed:
  20.  
  21. ux1> sed -n '210p'  filename
  22.  
  23. You can also look at a range of lines in the middle of the file
  24. like this:
  25.  
  26. ux1> sed -n '210,215p'  filename
  27.  
  28.  
  29.  
  30. ------------------------------------------------------------------------------
  31. Kris Klindworth                    Internet: krisk@ux1.cso.uiuc.edu
  32. Database Programmer                Phone   : (217)244-7120
  33. Illinois State Water Survey        US Mail : 2204 Griffith Dr
  34.                                              Champaign, IL 61820
  35.