The match command uses Korn shell pattern-matching characters to find words in a dictionary. It can be used to help with crossword puzzles, or test your patterns.
#!/bin/ksh # # match - Korn shell word-finder # # Check usage if (($# < 1 || $# > 2)) then print "Usage: $0 pattern [file]" exit 1 fi # Check/set DICT to word dictionary : ${DICT:=${2:-/usr/dict/words}} # Open $DICT for input exec 0<$DICT # Read each word into WORD while read WORD do # This command didn't work on all systems. If # it doesn't on yours, use this instead of # exec 0<$DICT: # cat $DICT | while read WORD # # If WORD matches the given pattern, # print the match [[ $WORD = $1 ]] && print - $WORD done
3.142.249.229