Hi all,
I really need some help on updateing the Unix /etc/passwd file.
Basically I have a script that reads it like the following...
$file = '/etc/passwd';
my $hash_ref;
my %hash_ref;
open FILE, "$file" or die "$file: $!\n";
while ( <FILE> ) {
my @list = split ':';
if($list[3] == 45) {
$hash_ref{$list[4]}=$list[0];
}
#return %hash_ref;
}
close FILE;
which creates the hash...
%hash_ref (
'Comment' => 'username',
'Comment1' => 'username1',
'Comment2' => 'username2'
);
Now I have no problem updating the hash. For example I could quite
easily add a * in front of a username like so...
$hash_ref{'Comment'}= "*username";
Then hash_ref woyuld now read the following...
%hash_ref (
'Comment' => '*username',
'Comment1' => 'username1',
'Comment2' => 'username2'
);
But the problem I am having is how would I go about telling my perl
script to go and place replace the username of username to *username.
Any ideas/suggestions would be greatly appriciated.
Regards,
Dan
==============================
VINTEK CONSULTING PTY LTD
(ACN 088 825 209)
Email: [EMAIL PROTECTED]
WWW: http://www.vintek.net
Tel: (08) 8523 5035
Fax: (08) 8523 2104
Snail: P.O. Box 312
Gawler SA 5118
==============================
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]