Created
October 13, 2017 21:50
-
-
Save ehershey/b02168d44b25b18a63a3a0c1af572727 to your computer and use it in GitHub Desktop.
Revisions
-
ehershey created this gist
Oct 13, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,47 @@ #!/usr/bin/perl # input is TSV in format with headers below from spreadsheet e.g. https://docs.google.com/spreadsheets/d/19itb2SErcZXT8AeCPylTZ0pXaTyZMwl5ncsGZ0ajsJM/edit#gid=0 # month, project, distro, cost, hours, tasks # # Output is TSV with column per distro suitable for stacked area chart # # use Data::Dumper; my $data = {}; while(<>) { ($month,$project,$distro,$cost,$hours,$tasks) = split(/\t/); $data->{$month}->{$distro} += $cost; } print "Month\t"; @months = keys $data; @distros = sort keys $data->{$months[0]}; for $distro (@distros) { print "$distro\t"; } print "\n"; # print Dumper \@distros; # print Dumper($data); # for $month (sort keys $data) { # skip header data, numeric month lines only #next unless $month =~ /^\d/; print "$month\t"; for $distro (@distros) { if(! $data->{$month}->{$distro}) { print "0"; } else { print $data->{$month}->{$distro}; } print "\t"; } print "\n"; }