home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / programm / 4032 < prev    next >
Encoding:
Internet Message Format  |  1992-07-31  |  975 b 

  1. Path: sparky!uunet!mcsun!uknet!tlg
  2. From: tlg@uknet.ac.uk (Tim.Goodwin)
  3. Newsgroups: comp.unix.programmer
  4. Subject: Re: Better way to find out the number of lines in a file
  5. Message-ID: <1254@uknet.ac.uk>
  6. Date: 31 Jul 92 12:08:06 GMT
  7. References: <1992Jul27.195754.26812@tin.monsanto.com> <1992Jul27.203700.5953@news.eng.convex.com> <5412@ucsbcsl.ucsb.edu>
  8. Organization: UKnet
  9. Lines: 19
  10.  
  11. In article <5412@ucsbcsl.ucsb.edu> 6500mack@ucsbuxa.ucsb.edu (Michael P. Mack) writes:
  12. >Somebody has done it.  On our system (HPUX 8.0) we have a command
  13. >called 'wc' which counts the lines, words, and characters in a file.
  14.  
  15. If you're only interested in the number of lines,
  16.  
  17.     grep -c '^'
  18.  
  19. is, on my system at least, much faster than
  20.  
  21.     wc -l
  22.  
  23. (That's GNU grep, of course.  It even seems to go faster than a naive
  24. mmap()ing line counter I have.)
  25.  
  26. Tim.
  27. -- 
  28. The GNU is in fact the legendary and much-berated | ; who am i
  29. feeping creature - Malcolm Wallace.               | uknet.ac.uk!tlg
  30.