[Gllug] issues with awk
dudes dudes
akam123 at hotmail.co.uk
Mon Sep 12 08:05:13 UTC 2011
thanks Alain,
unfortunately it doesn't return any results
ak
> Date: Mon, 12 Sep 2011 08:58:14 +0100
> From: addw at phcomp.co.uk
> To: gllug at gllug.org.uk
> Subject: Re: [Gllug] issues with awk
>
> On Mon, Sep 12, 2011 at 08:32:00AM +0100, dudes dudes wrote:
>
> > However; if I script this in bash such as:
> >
> > ip="127.0.0.1"
> >
> > awk '$1==$ip {print}' test.txt
> >
> > I never get the right results.
>
> $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
>
> --
> Alain Williams
> Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
> +44 (0) 787 668 0256 http://www.phcomp.co.uk/
> Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php
> #include <std_disclaimer.h>
> --
> 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/0fadca56/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