summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-05-07 14:32:59 +0000
committerJim Meyering <jim@meyering.net>1998-05-07 14:32:59 +0000
commitbf598c02ba03e5f438c3cce321338694529126e5 (patch)
tree06c209b886b4aa3fb7c3a94ecc72da0954581899 /doc
parent3954a4f4411ee3e4b6be81df139886034a5467ac (diff)
downloadcoreutils-bf598c02ba03e5f438c3cce321338694529126e5.tar.xz
add tr `double' script example
Diffstat (limited to 'doc')
-rw-r--r--doc/textutils.texi18
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/textutils.texi b/doc/textutils.texi
index 91329ec53..0eaf3bbc2 100644
--- a/doc/textutils.texi
+++ b/doc/textutils.texi
@@ -2696,6 +2696,24 @@ Convert each sequence of repeated newlines to a single newline:
tr -s '\n'
@end example
+@item
+Find doubled occurrences of words in a document.
+For example, people often write ``the the'' with the duplicated words
+separated by a newline. The bourne shell script below works first
+by converting each sequence of punctuation and blank characters to a
+single newline. That puts each ``word'' on a line by itself.
+Next it maps all uppercase characters to lower case, and finally it
+runs @code{uniq} with the @samp{-d} option to print out only the words
+that were adjacent duplicates.
+
+@example
+#!/bin/sh
+cat "$@@" \
+ | tr -s '[:punct:][:blank:]' '\n' \
+ | tr '[:upper:]' '[:lower:]' \
+ | uniq -d
+@end example
+
@end itemize