I have a file called simply "users" with a list of usernames like this...
jdoe
cpurcell
ltorvalds
I want to compare this file to my /etc/shadow file and pull the entries out of the shadow file that match. For example, if my shadow file looked like this...
hjablome:$1$89ekDhxk$MMKcoULbeURwAV4owiqB/:12585:0:99999:7:::
jdoe:$1$jn53vLCl$P/ZtXVPEWvIb518O3vr.:12585:0:99999:7:::
cpurcell:$1$gggLxru$XATg1YNJGi2IuiYCZSaZe.:12587:0:99999:7:::
nobody:$1$.AsmP4tL$Ebg1zADlMyv/w7TlhCqO0:12591:0:99999:7:::
ltorvalds:!!:12600:0:99999:7:::
...the script would return only the matches...
jdoe:$1$jn53vLCl$P/ZtXVPEWvIb518O3vr.:12585:0:99999:7:::
cpurcell:$1$gggLxru$XATg1YNJGi2IuiYCZSaZe.:12587:0:99999:7:::
ltorvalds:!!:12600:0:99999:7:::
I've tried getting this to work with all different kinds of foreach loops and grep statements but I can't get it, I'm still a Perl newbie. Anyone have any ideas on this?
Thanks,
Chris
jdoe
cpurcell
ltorvalds
I want to compare this file to my /etc/shadow file and pull the entries out of the shadow file that match. For example, if my shadow file looked like this...
hjablome:$1$89ekDhxk$MMKcoULbeURwAV4owiqB/:12585:0:99999:7:::
jdoe:$1$jn53vLCl$P/ZtXVPEWvIb518O3vr.:12585:0:99999:7:::
cpurcell:$1$gggLxru$XATg1YNJGi2IuiYCZSaZe.:12587:0:99999:7:::
nobody:$1$.AsmP4tL$Ebg1zADlMyv/w7TlhCqO0:12591:0:99999:7:::
ltorvalds:!!:12600:0:99999:7:::
...the script would return only the matches...
jdoe:$1$jn53vLCl$P/ZtXVPEWvIb518O3vr.:12585:0:99999:7:::
cpurcell:$1$gggLxru$XATg1YNJGi2IuiYCZSaZe.:12587:0:99999:7:::
ltorvalds:!!:12600:0:99999:7:::
I've tried getting this to work with all different kinds of foreach loops and grep statements but I can't get it, I'm still a Perl newbie. Anyone have any ideas on this?
Thanks,
Chris