2
# makedict.sh [make dictionary]
4
# Modification of /usr/sbin/mkdict (/usr/sbin/cracklib-forman) script.
5
# Original script copyright 1993, by Alec Muffett.
7
# This modified script included in this document in a manner
8
#+ consistent with the "LICENSE" document of the "Crack" package
9
#+ that the original script is a part of.
11
# This script processes text files to produce a sorted list
12
#+ of words found in the files.
13
# This may be useful for compiling dictionaries
14
#+ and for other lexicographic purposes.
19
if [ ! -r "$1" ] # Need at least one
20
then #+ valid file argument.
21
echo "Usage: $0 files-to-process"
26
# SORT="sort" # No longer necessary to define options
27
#+ to sort. Changed from original script.
29
cat $* | # Contents of specified files to stdout.
30
tr A-Z a-z | # Convert to lowercase.
31
tr ' ' '\012' | # New: change spaces to newlines.
32
# tr -cd '\012[a-z][0-9]' | # Get rid of everything non-alphanumeric
33
#+ (in original script).
34
tr -c '\012a-z' '\012' | # Rather than deleting non-alpha chars,
35
#+ change them to newlines.
36
sort | # $SORT options unnecessary now.
37
uniq | # Remove duplicates.
38
grep -v '^#' | # Delete lines beginning with a hashmark.
39
grep -v '^$' # Delete blank lines.