home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / question / 15045 < prev    next >
Encoding:
Text File  |  1992-12-30  |  1.2 KB  |  42 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!ames!pacbell.com!ptsfa!dmturne
  3. From: dmturne@ptsfa.PacBell.COM (Dave Turner)
  4. Subject: Re: How to total file sizes for selected files?
  5. Reply-To: dmturne@PacBell.COM (Dave Turner)
  6. Organization: Pacific * Bell, San Ramon, CA
  7. Date: Wed, 30 Dec 1992 08:31:26 GMT
  8. Message-ID: <1992Dec30.083126.26511@ptsfa.PacBell.COM>
  9. References: <103335@netnews.upenn.edu> <1992Dec29.144421.23845@news.eng.convex.com>
  10. Lines: 30
  11.  
  12. From the keyboard of gasser@eniac.seas.upenn.edu (Nathan Gasser):
  13. :I'm wondering how to print the total size for only selected files.
  14. :For example, "du" gives the total space occupied by all files in
  15. :this directory.  I want only those files, say, that end in .zip.
  16. :
  17. :% du
  18. :. 2883
  19. :
  20. :% du -s *.zip
  21. :123  file1.zip
  22. :188  arc2.zip
  23. :13   game.zip
  24. :
  25. :See, what I want is for the above example to print the total
  26. :space for the .zip files, ie. 324.
  27.  
  28. Assuming find -ls output resembling this:
  29.  
  30. (inum  block mode      links  user  group      bytes  mtime        name)
  31.  38976  544 -rw-rw-r--  1 tchrist  swtools    531409 Dec 15  1989 ./etc/hosts
  32.  
  33.  
  34. You might try wc:
  35.  
  36.     wc -c *.zip | sed -n '$p'
  37.  
  38.  
  39.  
  40. -- 
  41. Dave Turner    (510) 823-2001    {att,bellcore,sun,ames,decwrl}!pacbell!dmturne
  42.