home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / shell / 3756 < prev    next >
Encoding:
Text File  |  1992-09-01  |  1.1 KB  |  49 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!mcsun!sunic!ericom!eos.ericsson.se!etxmesa
  3. From: etxmesa@eos.ericsson.se (Michael Salmon)
  4. Subject: Re: Awk question
  5. Message-ID: <1992Sep2.073636.4871@ericsson.se>
  6. Sender: news@ericsson.se
  7. Nntp-Posting-Host: eos6c02.ericsson.se
  8. Reply-To: etxmesa@eos.ericsson.se (Michael Salmon)
  9. Organization: Ericsson Telecom AB
  10. References:  <BtxLJ3.BzE@nntp-sc.Intel.COM>
  11. Date: Wed, 2 Sep 1992 07:36:36 GMT
  12. Lines: 35
  13.  
  14. In article <BtxLJ3.BzE@nntp-sc.Intel.COM>, 
  15. brodesky@td2cad.intel.com (Michael Brodesky) writes:
  16. |> 
  17. |> 
  18. |> I would like to get the current year into my awk program. Any
  19. |> clues into doing this?
  20. |> 
  21. |> Do I need to 
  22. |> date |nawk -f code inputfile
  23. |> 
  24. |> 
  25. |> code
  26. |> {
  27. |> print $6
  28. |> }
  29. |> 
  30. |> 
  31. |> Only problem is it does not work.
  32.  
  33. I think that you need to insert a - to tell nawk to read stdin, however
  34. this is perhaps a better solution:
  35.  
  36.  eos6c02 xanim 40 > nawk 'BEGIN { print year }' `date +year=%y`
  37. 92
  38.  
  39. -- 
  40.  
  41. Michael Salmon
  42.  
  43. #include    <standard.disclaimer>
  44. #include    <witty.saying>
  45. #include    <fancy.pseudo.graphics>
  46.  
  47. Ericsson Telecom AB
  48. Stockholm
  49.