home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / question / 10206 < prev    next >
Encoding:
Text File  |  1992-08-19  |  1.1 KB  |  39 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!cs.utexas.edu!usc!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!unidui!unidui!hm342st
  3. From: hm342st@unidui.uni-duisburg.de (Michael Staats)
  4. Subject: Re: Simple AWK question.....
  5. References: <l96frkINNsom@phad.hsc.usc.edu>
  6. Date: 20 Aug 92 10:19:26 GMT
  7. Organization: Rechenzentrum Uni-Duisburg
  8. Message-ID: <hm342st.714305966@unidui>
  9. Lines: 28
  10.  
  11. In <l96frkINNsom@phad.hsc.usc.edu> rpinder@phad.hsc.usc.edu (Rich Pinder) writes:
  12.  
  13. >I'd like to reference the environment variable PWD inside an awk script.  I
  14. >wrote the following simple script to sum bytes in any given directory, and
  15. >would like the output to say:  Total Bytes in /usr/lib: 1024000 (1 MB).
  16.  
  17. >Thanks for you help
  18.  
  19.  
  20. >......................
  21.  
  22. >#    sums directory bytes (BSD)
  23.  
  24. What about 
  25.  
  26. $ echo Total kbytes in $PWD: `du -s .`
  27.  
  28. This works under AIX 3.1.5 with ksh and I hope under other BSD like OS, too.
  29. Under SYS V like OS you'll get twice the amount of kB, which is weird,
  30. but ...
  31.  
  32. So long
  33. Michael
  34. -- 
  35. Michael Staats
  36. Theoretische Tieftemperaturphysik
  37. Universitaet Gesamthochschule Duisburg
  38. michael@hal9000.uni-duisburg.de
  39.