HELP: Passing Unix vars to AWK 
Author Message
 HELP: Passing Unix vars to AWK

I have a sh script that calls awk and basically I have
3 vars declared outside of awk which I need to use
within awk, how do I pass them to awk?

here is part of the script

#!/bin/sh
LOGCHECK_LOG=$HOME/PROGS/logcheck.tmp
LAST_RAN_MONTH=`head -1 $LOGCHECK_LOG |awk '{print $1}'`
...

cat <file>| awk '{
if ($1 ~/<var>)
           ^_______this is where I want it
{
 ...

Quote:
}
}'

Any help immensly appreciated

Cheers

Mas'ud

--
=================================================================
                 Masud Ahmed Khan  Unix Engineer
                   Crosfield Electronics Ltd.,
    Three Cherry Trees Lane, Hemel Hempstead, Hertfordshire
         tel: +44 (0)1442 343098  Mobile: 0973 118 665
   ALL OPINIONS ARE MINE ONLY NOT THE COMPANY THAT I WORK FOR
=================================================================



Mon, 15 Feb 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. passing vars to awk script

2. Passing and getting vars. from C to awk

3. Help passing command line parameters to awk scripts

4. THANKS: Help passing command line parameters to awk script

5. How do I get vars into awk?

6. #!/bin/awk -f style and shell vars

7. Shell vars into Awk executable script not so easy

8. Vars in an awk command/revisit

9. initialize vars to zero in awk (long)

10. passing shell vars to gawk

11. passing vars to shell script

 

 
Powered by phpBB® Forum Software