home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / unix / question / 14726 < prev    next >
Encoding:
Internet Message Format  |  1992-12-16  |  1.5 KB

  1. Path: sparky!uunet!olivea!spool.mu.edu!umn.edu!csus.edu!netcom.com!dman
  2. From: dman@netcom.com (Dallman Ross)
  3. Newsgroups: comp.unix.questions
  4. Subject: Performing simple math on a numeric file from csh
  5. Message-ID: <1992Dec16.080343.24756@netcom.com>
  6. Date: 16 Dec 92 08:03:43 GMT
  7. Organization: Netcom - Online Communication Services  (408 241-9760 guest)
  8. Lines: 30
  9. X-Newsreader: TIN [version 1.1 PL7]
  10.  
  11. I am trying to understand awk, but the man pages are driving me nuts. 
  12. Anyway, I have a couple of simple files with numerics in them that I
  13. want to do some math with.  This doesn't have to be via awk, but I've
  14. been told that's the ticket.  Anyway, I use csh.
  15.  
  16. Here's what one of the files looks like:
  17.  
  18. > login:  Dec 15 21:40:01
  19. > logout: Dec 15 21:40:18
  20. > login:  Dec 15 21:41:11
  21. > logout: Dec 15 21:41:48
  22. > login:  Dec 15 22:20:08
  23. > logout: Dec 15 22:31:44
  24.  
  25. (No >'s in the file, of course.)  So, I want to subtract the
  26. penultimate time figure from the last figure, and come up with
  27. "00:11:36" as the answer for time logged in.  I only need to do the
  28. math on the last pair.  The rest is just a running log.
  29.  
  30. Thanks for any advice.
  31.  
  32. --
  33.  __D_a l_l m a_n  _ R o_s s _ |dman@netcom.com  /or/  |"You sound like a man|
  34.  l  \\ l\\   /l  /\\  l\\   l |dross@well.sf.ca.us    |with a rubber nose." |
  35.  l   >)l \\ /ll /  \\ l \\  l |vox/fax: 1.510.645.1883| -- One-Lung Bill    |
  36.  l  // l  \X ll/--- \\l  \\ l |350 Perkins St., #108  |     Remmer (deceased)
  37. _l//______________________\\l_|Oakland,_CA__94610-3422|_____________________|_
  38.