in reply to Re^2: How to Extract Data from Text file 1 based on the Value from Text file 2
in thread How to Extract Data from Text file 1 based on the Value from Text file 2
Modify the "$output" filename to suit your needs.
for my $customer ( keys %$cust ) { # If you want to write to a file named with the customer ID # my $output = "./$customer.out"; # If you want to write to a file named with the customer name my $output = "./$cust->{$customer}->{name}.out"; open (CUST_OUT, ">$output") || die "Can't write to '$output': $!\n +"; print CUST_OUT "CUSTOMER NAME: $cust->{$customer}->{name}\n" . "Device_Code Port Traf_Dir Data_Usage\n"; for my $device ( sort by_name keys %{$bill_data->{$customer}} ) { for my $port ( sort keys %{$bill_data->{$customer}->{$device}} + ) { (my $short_port = $port) =~ s/^FastEthernet/Fa/g; for my $direction qw(OUT IN) { print CUST_OUT "$device $short_port $direction " . $bill_data->{$customer}->{$device}->{$port}->{$dir +ection} . $/; } } } close CUST_OUT; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How to Extract Data from Text file 1 based on the Value from Text file 2
by roborat (Novice) on Mar 04, 2010 at 15:19 UTC | |
|
Re^4: How to Extract Data from Text file 1 based on the Value from Text file 2
by roborat (Novice) on Mar 05, 2010 at 08:35 UTC | |
by roborat (Novice) on Mar 05, 2010 at 10:47 UTC |