----- try this --------
#!/usr/bin/perl -w

$user = "daneilson";
$file       = '/etc/passwd';

open PASSSWD, "$file"  or die "Cannot open $file for reading :$!";
@lines = <PASSWD>;
foreach $record (@lines) {
            @record = split /:/, $record;
             if ($record[3] ==45) {
                ## do your things here !;
             }
}

----- end of msg -----
----- Original Message ----- 
From: "Daniel Falkenberg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 27, 2001 1:55 PM
Subject: Split


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.



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to