[TriLUG] possible awk/grep question

Joseph Mack NA3T jmack at wm7d.net
Sun Dec 30 18:38:39 EST 2007


On Sun, 30 Dec 2007, Craig Taylor wrote:

> As with anything else in Linux, there's a million ways...
>
> for USR in `cat /etc/group | grep ^user | sed "s/^.*:100://" | sed "s/,/
> /g"`; do
>    echo $USR
> done

Hi Craig,

thanks for the suggestion

 	Having thought about this for a week or so now, and 
not having an answer, after posting here, I googled and came 
up with

cat /etc/passwd | awk 'BEGIN { FS = ":" } $4 == "100" {print}'

I didn't know about the

$4 == "100"

construct

Joe

-- 
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!



More information about the TriLUG mailing list