5213aud|5210|PPA0200ScrubOak|5213 5223aud|5222|PPA0366HighKnobMtn|5223 5224aud|5222|PPA0366HighKnobMtn|5224 5225aud|5222|PPA0366HighKnobMtn|5225 5227aud|5226|PPA0101Greentown|5227 5228aud|5226|PPA0101Greentown|5228 5229aud|5226|PPA0101Greentown|5229 5231aud|5230|PPA0221MtYeager|5231 5232aud|5230|PPA0221MtYeager|5232 5233aud|5230|PPA0221MtYeager|5233 5235aud|5234|PPA0231Freeland|5235 5236aud|5234|PPA0231Freeland|5236 5237aud|5234|PPA0231Freeland|5237 5239aud|5238|PPA0034TylerCorner|5239 5240aud|5238|PPA0034TylerCorner|5240 5241aud|5238|PPA0034TylerCorner|5241 5243aud|5242|PPA0209Scranton|5243 5244aud|5242|PPA0209Scranton|5244 #### @omcees = ("pasys","audsys"); foreach $omc(@omcees){ if ($omc eq "pasys"){$id = "pa"} else{$id = "aud";} $filename = "combine".".txt"; ## May as well test them all now open(FIRST, "/mnt/$omc/ne_data/unload_stats/$currenttime/cel_ntid.unl") or die "Could not open first\n"; open(SECOND, "/mnt/$omc/ne_data/unload_stats/$currenttime/sit_ntid.unl") or die "Could not open second\n"; if ($omc eq "pasys"){ open(THIRD, ">/tmp/$filename" ) or die "Could not write third\n"; } else{ open(THIRD, ">>/tmp/$filename" ) or die "Could not write third\n"; } my (%first, %found); while() { my ($key, @cols) = split(m#\|# => $_, -1); push(@{$first{$key}}, \@cols); $found{$key} = $.; } close(FIRST); while() { my ($one, $key, @cols) = split(m#\|# => $_, -1); if (exists $first{$key}) { delete $found{$key}; for (@{$first{$key}}) { print THIRD $_->[0].$id."|$key|$cols[0]"; print THIRD "|".$_->[0]; print THIRD "\n"; } } } close(SECOND); close(THIRD); }