home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!nwnexus!ole!ssc!fyl
- From: fyl@ssc.wa.com (Phil Hughes)
- Subject: Re: Awk and getting the current date
- Organization: SSC, Inc., Seattle, WA
- Date: Thu, 03 Sep 1992 17:12:01 GMT
- Message-ID: <1992Sep03.171201.7724@ssc.wa.com>
- X-Newsreader: Tin 1.1 PL3
- References: <1992Sep1.214207.1@sc9>
- Lines: 18
-
- mbrodesky@sc9 writes:
- : How can I get the current date in a AWK program
-
- This is the most awk-ish way to do it:
-
- awk 'BEGIN {print dt}' dt="`date`" file
-
- The "program" in this example just consists of the "print dt" statement
- performed at begin time. Following the program, dt="`date`" executes
- the date command (because of the backquotes) and then assigns the result
- to the awk variable dt. The double quotes are needed as executing date
- expands to multiple words.
-
- --
- Phil Hughes, SSC, Inc. P.O. Box 55549, Seattle, WA 98155 (206)FOR-UNIX
- >>> Publishers of pocket references for UNIX, C, VI, Emacs, Ksh, MS-DOS, ... <<<
- uunet!nwnexus!ssc!fyl or fyl@ssc.wa.com (206)527-3385
-
-