[plug] awk problem

Jon Miller jlmiller at mmtnetworks.com.au
Wed Jan 11 06:26:04 WST 2006


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 = root) print $9,$10,$11,$12}' user.txt

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

Thanks
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: TEXT.htm
URL: <http://lists.plug.org.au/pipermail/plug/attachments/20060111/1eabfcb6/attachment.ksh>


More information about the plug mailing list