5 die "Usage: $0 <col> <input[gzipped]> <output prefix>\n" if @ARGV < 3;
6 my ($col,$inf,$outf)=@ARGV;
7 warn "From Col=[$col] of [$inf] to [$outf]\n";
10 my ($Sum,$Count,%Cnt)=(0,0);
15 if ($inf =~ /\.gz$/i) {
16 open $FH,'-|',"gzip -dc $inf" or die "Error opening $inf: $!\n";
17 } elsif ($inf =~ /\.xz$/i) {
18 open $FH,'-|',"xz -dc $inf" or die "Error opening $inf: $!\n";
19 } elsif ($inf =~ /\.bz2$/i) {
20 open $FH,'-|',"bzip2 -dc $inf" or die "Error opening $inf: $!\n";
22 open $FH,'<',$inf or die "Error opening $inf: $!\n";
27 my $FH = openFH
($inf);
29 my @Dat = split /\s+/;
37 open O
,'>',"$outf.dat" or die $!;
38 print O
"# TotalCount=$Count, ValueSum=$Sum, Average=",$Sum/$Count,"\n#Value\tCount\tCountRatio\tCumCountRatio\n";
41 for my $k (sort { $a<=> $b } keys %Cnt) { # $Cnt{$a} <=> $Cnt{$b} || $a<=> $b
42 $Cum += $Cnt{$k}/$Count;
43 print O
join("\t",$k,$Cnt{$k},$Cnt{$k}/$Count,$Cum),"\n";
48 set terminal png notransparent nointerlace size
1200,960 font
'/opt/arial.ttf' 24
54 plot
'tw.dat' using
1:2 with lines