home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / question / 15932 < prev    next >
Encoding:
Text File  |  1993-01-25  |  940 b   |  24 lines

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