I'd be more inclined to use -l in a command line so that chomps are done automatically when used with -n or -p, but a pure perl one liner could be ...
perl -nle 'print if -e "/home/$_/bin/filename"' file... if you needed to use a seperate file, but on UNIXish systems (possibly others?) you can use getpwent() to get usernames and home directories (esp. since they may not always be under /home/!) of active accounts instead of using a seperate file.
perl -le 'while (($u,$d)=(getpwent)[0,7]) { print $u if -e "$d/bin/$ARGV[0]" }' filename--k.
In reply to Re: Re: Command line question
by Kanji
in thread Command line question
by monk2b
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |