[TriLUG] possible awk/grep question

Craig Taylor ctalkobt at gmail.com
Sun Dec 30 18:25:51 EST 2007


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

On Dec 30, 2007 6:12 PM, Joseph Mack NA3T <jmack at wm7d.net> wrote:

> I need to find all "users" on a machine.
>
> It occurs to me that I could find this by looking for all
> lines in /etc/passwd that have "100" in the 4th field, but I
> don't know how to do that in bash/awk/grep, at least not in
> a small number of lines. If I can do that, then I have other
> uses for a script that can find all lines that match in a
> certain field. Anyone know how to do that?
>
> Failing that, anyone know how to find the members of a group
> (eg users) by any method?
>
> Thanks 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!
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
>



More information about the TriLUG mailing list