############################################################################ # # File: tabulate.icn # # Subject: Program to tabulate lines in a file # # Author: Ralph E. Griswold # # Date: February 28, 1999 # ############################################################################ # # This file is in the public domain. # ############################################################################ # # This program produces a tabulation showing how many times each # line of a file occurs. # ############################################################################ # # Links: options # ############################################################################ link options procedure main(args) local opts, tabulation tabulation := table(0) while tabulation[read()] +:= 1 tabulation := sort(tabulation, 3) while write(get(tabulation), " ", right(get(tabulation), 6)) end