home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!news
- From: rpinder@phad.hsc.usc.edu (Rich Pinder)
- Newsgroups: comp.unix.questions
- Subject: Simple AWK question.....
- Date: 19 Aug 1992 23:45:08 -0700
- Organization: University of Southern California, Los Angeles, CA
- Lines: 21
- Sender: rpinder@phad.hsc.usc.edu (Rich Pinder)
- Distribution: world
- Message-ID: <l96frkINNsom@phad.hsc.usc.edu>
- NNTP-Posting-Host: phad.hsc.usc.edu
-
- I'd like to reference the environment variable PWD inside an awk script. I
- wrote the following simple script to sum bytes in any given directory, and
- would like the output to say: Total Bytes in /usr/lib: 1024000 (1 MB).
-
- Thanks for you help
-
-
- ......................
-
- # sums directory bytes (BSD)
-
- ls -l | awk '
-
- {sum += $4}
-
- END {printf "Total Bytes in Directory: %10d (%7.1f MB)\n", sum, sum/1024000}
-
- --
-
-
- Rich
-