home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / question / 10698 < prev    next >
Encoding:
Internet Message Format  |  1992-09-03  |  991 b 

  1. Path: sparky!uunet!mcsun!uknet!axion!rtf.bt.co.uk!duplain
  2. From: duplain@rtf.bt.co.uk (Andy Duplain)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: Awk and getting the current date
  5. Message-ID: <1992Sep3.135708.28491@rtf.bt.co.uk>
  6. Date: 3 Sep 92 13:57:08 GMT
  7. References: <1992Sep1.214207.1@sc9>
  8. Organization: BT Customer Systems, Brighton, UK
  9. Lines: 22
  10.  
  11. In article <1992Sep1.214207.1@sc9> mbrodesky@sc9 writes:
  12. >How can I get the current date in a AWK program
  13.  
  14.     I assume you mean "awk" not "nawk" or "gawk"; nawk and gawk
  15.     allow commands to forked and the output from those commands
  16.     to be read (RTFM for details).  In awk you will have to wrap
  17.     the awk script in a shell script and assign the date to an
  18.     awk variable:
  19.     
  20.         #!/bin/sh
  21.         awk -e 'BEGIN { 
  22.             date="'`date`'"
  23.         }
  24.         {
  25.             print date
  26.         }'
  27.         
  28.         (or something like that)
  29.     
  30. -- 
  31. Andy Duplain, BT Customer Systems, Brighton, UK.            duplain@rtf.bt.co.uk
  32. #define    DISCLAIMER      My views and opinions are my own, and not my company's
  33.