[Gllug] issues with awk
dudes dudes
akam123 at hotmail.co.uk
Mon Sep 12 08:18:31 UTC 2011
hi Tet,
I have tried your approach before,doesn't return anything !
I don't understand why the variable doesn't get passed to awk ! (takes it as an empty string) !
cheers
ak
> To: gllug at gllug.org.uk
> From: sta296 at astradyne.co.uk
> Date: Mon, 12 Sep 2011 09:06:42 +0100
> Subject: Re: [Gllug] issues with awk
>
>
> Alain Williams writes:
>
> >$ip is in single quotes and so is not substituted by the shell.
> >The following might work (not tested):
> >
> > awk --assign ip=$ip '$1==$ip {print}' test.txt
>
> Or in the more general case, for commands that don't let you assign
> variables on the command line:
>
> awk '$1=='"$ip"' {print}' test.txt
>
> Tet
> --
> Gllug mailing list - Gllug at gllug.org.uk
> http://lists.gllug.org.uk/mailman/listinfo/gllug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20110912/7dc8de96/attachment.html>
-------------- next part --------------
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list