in reply to Re^3: 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
The output I am trying to do should be like: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}.txt"; open (CUST_OUT, ">$output") || die "Can't write to '$output': $!\n +"; print CUST_OUT "Data Transfer Report for $cust->{$customer}->{name +}\n" . "Period Device_Code Port T +raf_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 "$lastmonth_period $device $short_port +$direction" . $bill_data ->{$customer}->{$device}->{$port}->{$di +rection} . $/; } } } close(CUST_OUT); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: How to Extract Data from Text file 1 based on the Value from Text file 2
by roborat (Novice) on Mar 05, 2010 at 10:47 UTC |