Re: Log Analysis and alerting
From: Walter Roberson (roberson@ibd.nrc.ca)Date: 03/22/02
- Next message: Dan Mercer: "Re: Log Analysis and alerting"
- Previous message: Subba Rao: "Re: Log Analysis and alerting"
- In reply to: Subba Rao: "Re: Log Analysis and alerting"
- Next in thread: Dan Mercer: "Re: Log Analysis and alerting"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: roberson@ibd.nrc.ca (Walter Roberson) Date: 22 Mar 2002 16:34:16 GMT
In article <3C9B32A3.65A25C2D@attglobal.net>,
Subba Rao <sailorn@attglobal.net> wrote:
[in awk]
:From the command line $_ does print the line
Not in awk or nawk as implimented on SGI IRIX. I do not have my
old AT&T SVS R3 awk manuals handy at the moment, but I'm 99%
certain that $_ is not a part of the awk standard.
On the other hand, if you happen to be using ksh as your shell,
and you happen to be using double-quotes around your script instead
of single, then $_ will be expanded by ksh to mean "the last
argument of the previous command line". If there was no argument
to the previous command line, then it would come out empty, thus
transforming a {print $_} statement into {print } -- and
in awk/nawk, the print command without an argument prints the input.
$ tail /var/adm/SYSLOG | awk "{print $_}"
is $_ treated as a variable in the shell, with that value substituted
in and used just as if it had been typed in to the script.
$ tail /var/adm/SYSLOG | awk '{print $_}'
is $_ treated as a variable by awk, which will complain!
$ tail /var/adm/SYSLOG | nawk '{print $_}'
Illegal field $()
Input record number 1
Source line number 1
- Next message: Dan Mercer: "Re: Log Analysis and alerting"
- Previous message: Subba Rao: "Re: Log Analysis and alerting"
- In reply to: Subba Rao: "Re: Log Analysis and alerting"
- Next in thread: Dan Mercer: "Re: Log Analysis and alerting"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
|