]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
Find duplicate consecutive words in files
authorMichael Kerrisk <mtk.manpages@gmail.com>
Thu, 1 Mar 2007 16:24:55 +0000 (16:24 +0000)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Thu, 1 Mar 2007 16:24:55 +0000 (16:24 +0000)
scripts/find_repeated_words.sh [new file with mode: 0644]

diff --git a/scripts/find_repeated_words.sh b/scripts/find_repeated_words.sh
new file mode 100644 (file)
index 0000000..9d83009
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# A simple script for finding instances of repeated consecutive words
+# in manual pages -- human inspection can then determine if these
+# are real errors in the text.
+#
+# Usage: sh find_repeated_words.sh [file...]
+#
+for file in "$@" ; do 
+    words=$(man -l "$file" 2> /dev/null | col -b | \
+       tr ' \008' '\012' | sed -e '/^$/d' | \
+       awk 'BEGIN {p=""} {if (p==$0) print p; p=$0 }' | \
+       grep '[a-zA-Z]' | tr '\012' ' ')
+    if test "X$words" != "X"; then
+        echo "$file: $words"
+    fi
+done