awk variables

Wm E. Davidsen Jr davidsen at sixhub.UUCP
Mon Dec 3 14:56:58 AEST 1990


  awk reads variables off the command line. They appear between the
commands (or name of the command file) and the filename(s) to be
processed. That means you might specify the input filename, using '-' if
stdin is what you want (not all versions need this, all accept it).

As:

  awk '$3 == BAR { print $2 }' BAR=$5 file
                               ^^^^^^
                               Sets BAR in the awk environment

-- 
bill davidsen - davidsen at sixhub.uucp (uunet!crdgw1!sixhub!davidsen)
    sysop *IX BBS and Public Access UNIX
    moderator of comp.binaries.ibm.pc and 80386 mailing list
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.unix.shell mailing list