# Script: userids_bystring # Where: in $FEDIR/scripts where $FEDIR=/apps/nns_com/fea # # Purpose: Shows users on this network, selected by (sub)string matches # in 'ypcat passwd' list. # # Called by: feautils.menu/feahelpg.menu/who_ps.menu script # # Written by: B. Montandon 17Sep97 from userids_bydept script # Updated by: B. Montandon 10Sep98 added some example strings # # set -x . $FEDIR/scripts/clearnns echo "${HIbold}\ ............................................................................. Enter a (sub)string by which to search the list of 'sgia' users. ${HIreset} Examples: userid abc00 (part of) last name mith dept e13 ${HIbold} STRING (or null to exit) ==>${HIreset} \c" read NNS_STRING if test "$NNS_STRING" = "" then # break continue fi . $FEDIR/scripts/set_localoutlist echo "\ ....................................`date`........ Show Users on this network, 'sgia', matching string: $NNS_STRING in the list of 'sgia' users. (Sorts selections by department.) Command used: ypcat passwd | grep \"$NNS_STRING\" | sort -r -t, +1 -2 +0 -1 | awk -F: '{printf "%-9s %5s %5s \" \" %-25s %-20s %-8s", \$1 , \$3 , \$4, \$5 , \$6 , \$7; print \"\" }' This report can be generated by FEA/MCADD menu option 'h su' (or the same utility at options 'u h i' or 'u n i' or ' u o i'). Run on Host `hostname` .............................................................................. User Group Userid Num Num User Name , Dept HomeDirectory LoginShell -------- ---- ---- -------------------------- ---------------- ---------- " > $OUTLIST # ypcat passwd | sort -r -t, +1 -2 +0 -1 | cut -d: -f1,3,4,5,6,7 >> $HOME/temp.lis ypcat passwd | grep "$NNS_STRING" | sort -r -t, +1 -2 +0 -1 | awk -F: \ '{printf "%-9s %5s %5s " " %-25s %-20s %-8s", $1 , $3 , $4, $5 , $6 , $7; \ print "" }' >> $OUTLIST . $FEDIR/scripts/shofil $OUTLIST