Created
December 13, 2015 00:34
-
-
Save kuninet/864c465e5fb2a3bba184 to your computer and use it in GitHub Desktop.
CSVで名前ごとに金額集計
This file contains 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
# | |
# 名前ごとに金額集計 | |
# | |
BEGIN{ | |
FS = "," | |
} | |
{ | |
total[$2] += $4 # 配列の添え字は文字列OK (Perlのハッシュ) | |
} | |
END{ | |
print "-- 金額集計結果 --" | |
for(i in total){ | |
printf("%sさん:%d円\n",i,total[i]) # C言語みたいなprintf関数もあるよ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment