home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!cs.utexas.edu!torn!cunews!nrcnet0!bnrgate!bcars267!bcarh803!christo
- From: christo@bcarh803.BNR.CA (Mark Christopher)
- Subject: Re: Awk and getting the current date
- Message-ID: <1992Sep3.222004.12240@bnr.ca>
- Sender: news@bnr.ca (usenet)
- Nntp-Posting-Host: bcarh803
- Reply-To: christo@bnr.ca
- Organization: Bell-Northern Research Ltd.
- References: <1992Sep1.214207.1@sc9> <1992Sep3.135708.28491@rtf.bt.co.uk>
- Date: Thu, 3 Sep 1992 22:20:04 GMT
- Lines: 21
-
- In article <1992Sep3.135708.28491@rtf.bt.co.uk>, duplain@rtf.bt.co.uk
- (Andy Duplain) writes:
- |>In article <1992Sep1.214207.1@sc9> mbrodesky@sc9 writes:
- |>>How can I get the current date in a AWK program
- ...
- |> #!/bin/sh
- |> awk -e 'BEGIN {
- |> date="'`date`'"
- |> }
- ...
-
- Or in nawk:
-
- nawk 'BEGIN { "date" | getline; date=$0}
- {
- print date,$0
- }'
-
- Not tough. Learn to read the manual.
- --
- Mark Christopher Bell-Northern Research christo@bnr.ca
-