2007-03-01 16:24:55 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2013-09-16 02:41:47 +00:00
|
|
|
# find_repeated_words.sh
|
|
|
|
#
|
2007-03-01 16:24:55 +00:00
|
|
|
# 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...]
|
|
|
|
#
|
2013-09-16 02:49:38 +00:00
|
|
|
######################################################################
|
|
|
|
#
|
|
|
|
# (C) Copyright 2007 & 2013, Michael Kerrisk
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details
|
|
|
|
# (http://www.gnu.org/licenses/gpl-2.0.html).
|
|
|
|
#
|
|
|
|
#
|
2007-09-10 04:14:12 +00:00
|
|
|
|
2007-03-01 16:24:55 +00:00
|
|
|
for file in "$@" ; do
|
2010-08-29 12:41:52 +00:00
|
|
|
words=$(MANWIDTH=2000 man -l "$file" 2> /dev/null | col -b | \
|
2007-03-01 16:24:55 +00:00
|
|
|
tr ' \008' '\012' | sed -e '/^$/d' | \
|
2010-08-29 12:41:52 +00:00
|
|
|
sed 's/ *$//' |
|
|
|
|
awk 'BEGIN {p=""} {if (p==$0) print p; p=$0}' | \
|
2007-03-01 16:24:55 +00:00
|
|
|
grep '[a-zA-Z]' | tr '\012' ' ')
|
2007-09-19 21:23:50 +00:00
|
|
|
if test -n "$words"; then
|
2007-03-01 16:24:55 +00:00
|
|
|
echo "$file: $words"
|
|
|
|
fi
|
|
|
|
done
|