#!/usr/local/bin/perl -w # # findperson (C) 1997-2000 Stuart Caie # greps the password file for names, logically ANDs your search args # this is distributed under the terms of the GNU public license version 2 # use strict; # command that dumps the password file to stdout: # this might also be 'niscat passwd.org_dir', or 'cat /etc/passwd' my $GET_PASSWD = 'ypcat passwd'; die "Usage: $0 name(s) or username\n" if $#ARGV < 0; $|=1; print "Searching..."; my $search = $GET_PASSWD . join ' | grep -i ', ('', @ARGV); my @results = `$search`; die "\nNothing found, sorry.\n" if $#results < 0; foreach (@results) { my ($login, $passwd, $uid, $gid, $desc, $home, $shell)=split ':'; print <