[OCLUG-devel] Learning awk

Kevin Brouelette kevin1a at varlog.net
Mon Apr 26 22:16:04 PDT 2004


Hello,

I'm spending my weeknights this week brushing up on bash shell.
The book I'm working with is Addison-Wesley's 'Linux & Unix shell 
Programing' by David Tansley.

Chapter 9 is about 'awk'. 
After reading the chapter,
I thought I would try to use awk to grab the users 
which their UID from /etc/passwd is greater than 999.
[Slackware UIDs start at 1000]

So I try this:
awk -F: '{if($2 > 999) print$0"\t"$2}' /etc/passwd

hoping to print the name, a 'tab', and the UID.

It echo's the whole /etc/passwd file and no errors.
Am I close or am I off base with trying to do this with awk?

TIA

Kevin B







More information about the OCLUG-devel mailing list