]>
Commit | Line | Data |
---|---|---|
f1b98114 MK |
1 | #!/bin/sh |
2 | # | |
d60ee883 MK |
3 | # find_repeated_words.sh |
4 | # | |
f1b98114 MK |
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. | |
8 | # | |
9 | # Usage: sh find_repeated_words.sh [file...] | |
10 | # | |
404b6a03 MK |
11 | ###################################################################### |
12 | # | |
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. | |
18 | # | |
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). | |
24 | # | |
25 | # | |
c092684f | 26 | |
f1b98114 | 27 | for file in "$@" ; do |
1870c751 SA |
28 | # Do not process files that are redirects. |
29 | grep -qE "^\.so man.*" "$file" | |
30 | if test $? -ne 0; then | |
606043ca | 31 | words=$(MANWIDTH=2000 man -l "$file" 2> /dev/null | col -b | \ |
f1b98114 | 32 | tr ' \008' '\012' | sed -e '/^$/d' | \ |
606043ca MK |
33 | sed 's/ *$//' | |
34 | awk 'BEGIN {p=""} {if (p==$0) print p; p=$0}' | \ | |
f1b98114 | 35 | grep '[a-zA-Z]' | tr '\012' ' ') |
028bd83c | 36 | if test -n "$words"; then |
f1b98114 MK |
37 | echo "$file: $words" |
38 | fi | |
1870c751 | 39 | fi |
f1b98114 | 40 | done |