Created
May 8, 2013 13:39
-
-
Save hrpunio/5540475 to your computer and use it in GitHub Desktop.
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 characters
#!/usr/bin/awk -f | |
# Podsumowanie gw. kategorii | |
# Wykonanie awk -f foo2.awk co='wartosc' plik | |
# | |
BEGIN { | |
sub("^:","#>", co); sub(":$","#<", co); | |
gsub(":",":[^:]*:", co); | |
sub("^#>",":", co); sub("#<$",":", co); | |
print "Szukam: " co ; } | |
$0 ~ /<<month>>/ { if (sum > 0 ) {mn++; M[ mn " : " cm ] = summ ; summ = 0; }; | |
cm = $3; next } | |
$0 ~ co {sum +=$1 ; summ+=$1; print $0 " ; " cm ;} | |
END { print "Razem: " sum } | |
END { | |
print "Miesiace: " | |
for ( m in M ) { | |
print m " : " M[m] | " sort -n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment