[plug] awk problem

Bernd Felsche bernie at innovative.iinet.net.au
Wed Jan 11 07:38:52 WST 2006


"Jon  Miller" <jlmiller at mmtnetworks.com.au> writes:

>I have a text file called user.txt that has the following structure =
>(generated by issuing the ls -l >text.txt)

>-rw-------    1 abbies   mail        21366 Jan 10 15:39 abbies
>-rw-------    1 root     root       381596 Jan 10 07:08 admin
>-rw-------    1 root     root        23891 Jan 10 07:08 amandab
>-rw-r-----    1 root     root       107500 Jan 10 07:08 annaleseo
>-rw-------    1 root     root      9639566 Jan 10 07:08 annas
>-rw-------    1 balwyn   mail       447459 Jan 11 05:40 balwyn

>I only want the results to show the username ($9) whose user field ($3) =
>equal root.  I constructed the following command but it yields nothing.

> awk '{if ($3 =3D root) print $9,$10,$11,$12}' user.txt

>I tried where $3 >=3D and $3 > and it yield the entire list.  For some =
>reason I cannot get the "=3D" sign to work.  Is there something speacial I =
>have to do to make it work?

I suspect that amongst all the MIME crap, that you haven't realized
that awk thinks that root is a variable name and not a value.
-- 
/"\ Bernd Felsche - Innovative Reckoning, Perth, Western Australia
\ /  ASCII ribbon campaign | Cynicism \Cyn"i*cism\
 X   against HTML mail     | A visual defect caused by the
/ \  and postings          | intrusion of reality




More information about the plug mailing list