Re: Passing a shell parameter to awk
am 19.12.2007 05:33:07 von Vakayil Thobias
wrote in message
news:4cd7d9d1-1678-41e3-aa77-e082b40492a6@d21g2000prf.google groups.com...
Hi:
please, how can I pass a shell parameter to an awk command ?
>cat script
memory=20480
value=1380
echo $value | awk ´{ calc=$memory-$1*8192/1024/1024}´
Thanks.
echo $memory $value | awk '{print $1 $2}'
the variable $memory will pass as $1 and $value will be pass as $2 in awk.
Re: Passing a shell parameter to awk
am 19.12.2007 10:35:04 von Janis Papanagnou
On 19 Dez., 03:14, apogeusiste...@gmail.com wrote:
> Hi:
> please, how can I pass a shell parameter to an awk command ?
>
> >cat script
>
> memory=3D20480
> value=3D1380
> echo $value | awk =B4{ calc=3D$memory-$1*8192/1024/1024}=B4
>
> Thanks.
echo $value | awk -v m=3D$memory '{ calc=3Dm-$1*8192/1024/1024}'
Janis