in reply to Re^2: Reformat RAW Excel Data
in thread Reformat RAW Excel Data
#!/bin/perl my @months=qw/"" jan feb mar apr may jun jul aug sep oct nov dec/; open(DATAS,"<","sales.txt") ; my (%report,$cust,$value,$date); for (@months) { print "$_","\t"; } print "\n"; while (<DATAS>) { chomp; if (/^[A-Z]/) { $cust = $_; @{$report{$cust}} = map { 0 } @months; next; } ($date,$value) = split ' ', $_; my ($mon,$year) = split '/',$date; $report{$cust}[$mon]=$value; } foreach my $keys (keys %report) { print $keys,"\t"; for (0..12) { print $report{$keys}[$_],"\t"; } print "\n"; } print "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Reformat RAW Excel Data
by 1nickt (Canon) on Jan 12, 2016 at 03:45 UTC |