[Gllug] issues with awk

Tethys sta296 at astradyne.co.uk
Mon Sep 12 08:38:28 UTC 2011

dudes dudes writes:

>I have tried your approach before,doesn't return anything !

Oops. I forgot the match needed to be a string:

	awk '$1=="'"$ip"'" {print}' test.txt

>I don't understand why the variable doesn't get passed to awk !
>(takes it as an empty string) !

As Alain explained, the single quotes mean that the shell doesn't
perform variable expansion. See the "QUOTING" secion of the bash
man page.

Gllug mailing list  -  Gllug at gllug.org.uk

More information about the GLLUG mailing list