[aklug] Question about awk

From: Joshua J. Kugler <joshua@eeinternet.com>
Date: Wed Sep 22 2010 - 11:19:29 AKDT

Since we have a few awk-ward folks on the list, I thought I'd throw this
out. I'm sure I'm missing something simple, but from my limited
knowledge of awk, and reading the man pages, I'm not able to make this
work.

MIN=1000
OKUSERS='(www-priv,www-data)'

# This is all one line
users_to_ignore=`cat /etc/passwd | awk -F":" '{if ($3 <'$MIN'
&& "'$OKUSERS'" !~ /\W$1\W/) print $1 ","}' | xargs -i echo -n {}`

echo users_to_ignore

This is printing all the users with UIDs below 1000.

What small thing am I missing so it will not include users in OKUSERS in
its final output?

j

-- 
Joshua Kugler
Part-Time System Admin/Programmer
http://www.eeinternet.com - Fairbanks, AK
PGP Key: http://pgp.mit.edu/  ID 0x73B13B6A
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Wed Sep 22 11:19:49 2010

This archive was generated by hypermail 2.1.8 : Wed Sep 22 2010 - 11:19:50 AKDT