#!/usr/local/gnubin/gawk -f # Print passwd(5) entries from input files which appear to be active # accounts (i.e. have valid shells listed in /etc/shells and whose # passwords are not "*" BEGIN { shellfile = "/etc/shells" ; while ((getline < shellfile) > 0) if ( $1 !~ "^#.*" ) valid_shells[$1] = $1 ; close(shellfile); FS = ":" } { if ( $2 != "*" && ( $7 in valid_shells || $7 == "" )) print $0 } # eof