home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!linac!att!mcdchg!chinet!les
- From: les@chinet.chi.il.us (Leslie Mikesell)
- Subject: Re: How to add a list of numbers?
- Organization: Chinet - Public Access UNIX
- Date: Mon, 25 Jan 1993 18:25:34 GMT
- Message-ID: <C1F9up.3oz@chinet.chi.il.us>
- References: <1993Jan24.120619.5072@mark-one.inet-uk.co.uk>
- Lines: 13
-
- In article <1993Jan24.120619.5072@mark-one.inet-uk.co.uk> mark@mark-one.inet-uk.co.uk (Mark Powell) writes:
- >What is the best (least CPU time) to addup a list of ASCII numbers?
- >eg you've just used cut to extract a list of file sizes from a ls -l
- >listing and now want to add all the numbers together. Is there some
- >utility that will do this?
- >All I can see is to write a for loop to add each number in turn to a
- >total, using expr.
-
- Use awk instead of cut in the first place since it can both extract
- and add.
-
- Les Mikesell
- les@chinet.chi.il.us
-