[plug] awk problem

Jon Miller jlmiller at mmtnetworks.com.au
Wed Jan 11 09:04:54 WST 2006


Correct me if I'm wrong but, I would think that since awk is reading the contents of a file and one of the columns contain the word "root",  awk would be "searching" for the word and not a variable since no variables has been declared.  But as I stated in my following e-mail I was able to figure out what I did wrong in the command structure and that was I left out it's "search" function.


BTW
Sorry about the mime crap, for some reason the mail client in GroupWise keeps returning to a default html format when I've set it to only do plain text.  I'll have to check this when I get to the office.


>>> bernie at innovative.iinet.net.au 7:38:52 am 11/01/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\
 against HTML mail | A visual defect caused by the
/ \ and postings | intrusion of reality

_______________________________________________
PLUG discussion list: plug at plug.org.au 
http://www.plug.org.au/mailman/listinfo/plug 
Committee e-mail: committee at plug.linux.org.au




More information about the plug mailing list