Hi,
Code:
TRASFORMER=$( echo "$line" | tr "[:upper:]" "[:lower:]" | sed -e 's/\.//g' -e 's/\,//g' -e 's/\-//g' -e 's/ //g' )
You don't have to put each character into a separate regexp. You can just write
Code:
sed -e 's/[.,- ]//g'
Also, if you have recent enough
bash, this should work:
Code:
TRANSFORMER="${line//[,.- ]/}"
You can also transform the text to lower/upper case like this:
Code:
lower="${line,,}"
upper="${line^^}"
But this is not necessary, since your greps are case-insensitive anyway.
Code:
sed: expression -e #1, character 5: command `s' not terminated
This is because you don't quote the expression:
if
$WORD contains any whitespace characters, the expression will be word-split by bash.
My guess is, the
Code:
WORD=$( fgrep -w -i "$TRASFORMER" "$dictfile" )
finds multiple matches in your
$dictfile, so
$WORD contains multiple words separated by newlines.