ambevar-dotfiles/.scripts/tc-text-scan

35 lines
534 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!/bin/sh
usage () {
cat <<EOF>&2
Usage: ${0##*/} FOLDERS
Check for files containing common mispelling:
- "\`" and "´" instead of "'",
- "oe" instead of "œ".
EOF
}
[ $# -eq 0 ] && usage && exit 1
[ "$1" = "-h" ] && usage && exit
[ "$1" = "--" ] && shift
if ! command -v recode >/dev/null 2>&1; then
echo >&2 "recode needed."
exit 1
fi
for i ; do
while IFS= read -r j; do
printf "# "
file "$j"
grep -m1 "\`" "$j"
grep -m1 "´" "$j"
grep -m1 "oe" "$j"
done <<EOF
$(find "$i" -type f -size -50M -print)
EOF
done