home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!axion!rtf.bt.co.uk!duplain
- From: duplain@rtf.bt.co.uk (Andy Duplain)
- Newsgroups: comp.unix.questions
- Subject: Re: Awk and getting the current date
- Message-ID: <1992Sep3.135708.28491@rtf.bt.co.uk>
- Date: 3 Sep 92 13:57:08 GMT
- References: <1992Sep1.214207.1@sc9>
- Organization: BT Customer Systems, Brighton, UK
- Lines: 22
-
- In article <1992Sep1.214207.1@sc9> mbrodesky@sc9 writes:
- >How can I get the current date in a AWK program
-
- I assume you mean "awk" not "nawk" or "gawk"; nawk and gawk
- allow commands to forked and the output from those commands
- to be read (RTFM for details). In awk you will have to wrap
- the awk script in a shell script and assign the date to an
- awk variable:
-
- #!/bin/sh
- awk -e 'BEGIN {
- date="'`date`'"
- }
- {
- print date
- }'
-
- (or something like that)
-
- --
- Andy Duplain, BT Customer Systems, Brighton, UK. duplain@rtf.bt.co.uk
- #define DISCLAIMER My views and opinions are my own, and not my company's
-