Xref: utzoo comp.unix.ultrix:2048 comp.unix.questions:17236 Path: utzoo!attcan!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!usc!snorkelwacker!spdcc!xylogics!world!madd From: madd@world.std.com (jim frost) Newsgroups: comp.unix.ultrix,comp.unix.questions Subject: Re: Can ls show total Kbytes of "foo*"? Message-ID: <1989Oct27.130914.12943@world.std.com> Date: 27 Oct 89 13:09:14 GMT References: <2453@umbc3.UMBC.EDU> Reply-To: madd@world.UUCP (jim frost) Organization: Software Tool & Die Lines: 18 In article <2453@umbc3.UMBC.EDU> rostamia@umbc3.UMBC.EDU (Rouben Rostamian) writes: | |I wonder if there is an obvious way to compute the total size of all |"foo*" files in a directory. The only way I know how is the ridiculously |complicated construction: | |ls -1s foo* | awk 'BEGIN{size=0} {size += $1} END{print "total: " size}' [...] |Am I missing something obvious? Yes. You could just do "wc -c foo* | tail -1". If you don't do the tail it will display the size of each followed by a summary line; with it you get just the summary line or -- if there's only one file -- just the size. jim frost software tool & die "The World" Public Access Unix for the '90s madd@std.com +1 617-739-WRLD 24hrs {3,12,24}00bps