[EMAIL PROTECTED] wrote on 13/09/2004 02:17:52 PM:
> #!/bin/bash
>
> SOMEVARIABLE
>
>
> VAR2="$( awk -F, "/$SOMEVARIABLE/ /some/pathtoafile/")"
>
>
> Now I have problems with my " I can't use ' because I want SOMEVARIABLE
> to be subsituted I have tried
>
> VAR2="$( awk -F, \"/$SOMEVARIABLE/ /some/pathtoafile/\")"
>
Awk doesn't handle variables, so it would be litterally looking for
$SOMEVARIABLE
You will need to put in ENVIRON[SOMEVARIABLE] instead.
eg:
rrdemo:/usr/src/zaptel# export TEST=mytest
rrdemo:/usr/src/zaptel# echo mytest |awk '{if (match($0,"$TEST")) print};'
rrdemo:/usr/src/zaptel# echo mytest |awk '{if (match($0,ENVIRON[TEST]))
print};'
mytest
Cheers,
Scott
>
> but it starts going haywire!
>
>
> Alex
>
> [attachment "signature.asc" deleted by Scott Ragen/Roadtech] --
> SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
> Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html