summaryrefslogtreecommitdiff
path: root/ipl/progs/tabulate.icn
diff options
context:
space:
mode:
Diffstat (limited to 'ipl/progs/tabulate.icn')
-rw-r--r--ipl/progs/tabulate.icn39
1 files changed, 39 insertions, 0 deletions
diff --git a/ipl/progs/tabulate.icn b/ipl/progs/tabulate.icn
new file mode 100644
index 0000000..6b03d3c
--- /dev/null
+++ b/ipl/progs/tabulate.icn
@@ -0,0 +1,39 @@
+############################################################################
+#
+# 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