[nmglug] awk pattern found

Karl Hegbloom karlheg at laclinux.com
Fri Jan 20 16:32:57 PST 2006


On Fri, 2006-01-20 at 11:26 -0700, Andres Paglayan wrote:
> does anybody knows which variable in awk will hold the pattern found?

I just typed "info gawk", and found it fairly quickly...

$0 is the input line, and a regexp constant by itself means $0 ~ /expr/.
The line is tokenized on whitespace (probably $IFS) and each token is
$1, $2, etc, so you can test $1 ~ /expr/ if you like.  It does not look
like Awk supports capturing of matched subexpressions as in Sed or Perl.

-- 
Karl Hegbloom <karlheg at laclinux.com>
Los Alamos Computers, Technical Support





More information about the nmglug mailing list