#!/usr/local/bin/gawk -f { for (i = 1; i <= NF; i++) { word[$i]++ } } END { for (i in word) { print i, word[i] | "sort" } close("sort") }
● 実行してみる
END { for (i in word) { print i, word[i] | "sort +1 -nr" } close("sort +1 -nr") }
END { com = "sort +1 -nr" for (i in word) { print i, word[i] | com } close(com) }