M
marcorice
Hi, I'm very new to perl and i believe i'm having a problem with nested
loops.
I have script that I want it to read a file "name_change", file is
already delimited, while it is reading the file if it finds a match in
a particular field with that in the passwd, shadow and group file,
SUBSTITUTE that $field in the passwd, shadow and group file. But it is
not continuing to read the next line in name_chage nor substituting,
PLEASE HELP.
my $name_change = "./UIDs_n_IDs_Not_Match";
open(name_change,"$name_change") or die ("Can't open
$name_change:$!\n");
my @name_change2 = <name_change>;
@ARGV = ("passwd", "shadow", "group");
while (@name_change){
my ($NULL1,$unixid2,$NULL2,$unixuid2,$NULL3,$NULL4,$ntid,$NULL5,$ntuid)
= split /\s*\|\s*/;
while (my $file=<>){
if ($ARGV eq "passwd"){
$file =~ s/^$unixid2:/$ntid:/;
print "$ARGV $file";
}
} #end of while
} #end of foreach
loops.
I have script that I want it to read a file "name_change", file is
already delimited, while it is reading the file if it finds a match in
a particular field with that in the passwd, shadow and group file,
SUBSTITUTE that $field in the passwd, shadow and group file. But it is
not continuing to read the next line in name_chage nor substituting,
PLEASE HELP.
my $name_change = "./UIDs_n_IDs_Not_Match";
open(name_change,"$name_change") or die ("Can't open
$name_change:$!\n");
my @name_change2 = <name_change>;
@ARGV = ("passwd", "shadow", "group");
while (@name_change){
my ($NULL1,$unixid2,$NULL2,$unixuid2,$NULL3,$NULL4,$ntid,$NULL5,$ntuid)
= split /\s*\|\s*/;
while (my $file=<>){
if ($ARGV eq "passwd"){
$file =~ s/^$unixid2:/$ntid:/;
print "$ARGV $file";
}
} #end of while
} #end of foreach