[PLUG] awk script
Don Buchholz
don at truedisk.com
Thu Sep 26 19:51:21 UTC 2002
My first shot would be:
awk "(\$15 ~ /(${lcUser}|${ucUser})/) {print \$1 \$2 \" \" \$3 \"
\" \$12}" m.log
Replace the single quotes with double quotes at each end of your awk(1)
command string. And then use the backslash (\) to escape all the shell
meta-characters (the dollar signs [$] and embedded double quotes ["] ).
- Don
Michael Montagne wrote:
>I need to parse my mail log for all mail received.
>I have this awk script:
>awk '($15 ~ /(montagne|MONTAGNE)/) {print $1 $2 " " $3 " " $12}' m.log
>
>But obviously m.log should be /var/log/mail.log
>
>My trouble is that I want to pass the user name to the script. It
>should then use that name in the "or" part of the regexp in both upper
>and lower cases and also output the results to a file called
>username.txt.
>
>And all should be invoked simply, like "showmail username"
>
>
>
>
>
More information about the PLUG
mailing list