From 399644e47874bff147afb19c89228901ac39340e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 21:40:15 +0200 Subject: Adding upstream version 6.05.01. Signed-off-by: Daniel Baumann --- scripts/find_repeated_words.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 scripts/find_repeated_words.sh (limited to 'scripts/find_repeated_words.sh') diff --git a/scripts/find_repeated_words.sh b/scripts/find_repeated_words.sh new file mode 100755 index 0000000..747872e --- /dev/null +++ b/scripts/find_repeated_words.sh @@ -0,0 +1,40 @@ +#!/bin/sh +# +# find_repeated_words.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...] +# +###################################################################### +# +# (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). +# +# + +for file in "$@" ; do + # Do not process files that are redirects. + grep -qE "^\.so man.*" "$file" + if test $? -ne 0; then + words=$(MANWIDTH=2000 man -l "$file" 2> /dev/null | col -b | \ + tr ' \008' '\012' | sed -e '/^$/d' | \ + sed 's/ *$//' | + awk 'BEGIN {p=""} {if (p==$0) print p; p=$0}' | \ + grep '[a-zA-Z]' | tr '\012' ' ') + if test -n "$words"; then + echo "$file: $words" + fi + fi +done -- cgit v1.2.3