3 # find_repeated_words.sh
5 # A simple script for finding instances of repeated consecutive words
6 # in manual pages -- human inspection can then determine if these
7 # are real errors in the text.
9 # Usage: sh find_repeated_words.sh [file...]
11 ######################################################################
13 # (C) Copyright 2007 & 2013, Michael Kerrisk
14 # This program is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License
16 # as published by the Free Software Foundation; either version 2
17 # of the License, or (at your option) any later version.
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details
23 # (http://www.gnu.org/licenses/gpl-2.0.html).
28 # Do not process files that are redirects.
29 grep -qE "^\.so man.*" "$file"
30 if test $?
-ne 0; then
31 words
=$
(MANWIDTH
=2000 man
-l "$file" 2> /dev
/null |
col -b | \
32 tr ' \008' '\012' |
sed -e '/^$/d' | \
34 awk 'BEGIN {p=""} {if (p==$0) print p; p=$0}' | \
35 grep '[a-zA-Z]' |
tr '\012' ' ')
36 if test -n "$words"; then