Hey all, I have a problem here that I don't really know how to go about.
Basically I want to be able to find a user in the /etc/passwd with only a GID of 45 and a username of what I type the user name to be. test5:x:503:503::/home/tunnel:/bin/bash test:x:504:45:Test Account:/home/test:/bin/false test4:x:506:505:test Account:/home/test4:/bin/false test2:x:507:45:Test Account:/home/test2:/bin/false daniel:x:508:45:Daniel Merritt:/home/daniel:/bin/false As we all know the Unix /etc/passwd file looks like the above... Now with the following I want to be able to only find the user name that has a GID of 45 and make sure the username exists in /etc/passd in the first place. #!/usr/bin/perl -w $user = "daneilson"; $file = '/etc/passwd'; open PASSSWD, "$file" or die "Cannot open $file for reading :$!"; #Store /etc/passwd as a file while ( $lines = <PASSWD>) { #split the /etc/passwd file at every colon and store it as an array. @lines = split (/:/, $lines); } #Now for the fun part... #Here I need to be able to search through @lines for the username I enter $lines[0] #if $user is not found then I need to report an error #else if $user is found then I need it to check that it has a GID of 45 and if it doesn't #then I need to report another error. Regards, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]