Re: Grep on dictionary words
Dotan writes:
> Is there a way to grep the output of strings in order to only show
> lines that contain words found in the aspell dictionary?
Try this:
#!/bin/bash
strings "$1" | while read line
do
if [ ` echo "$line" | sed -e 's/[^a-zA-Z ]//g' | wc -m` -lt 6 ]
then
continue
fi
echo "$line" | sed -e 's/[^a-zA-Z ]//g' | aspell -W1 --dont-guess --dont-suggest -a | grep -q '\*'
if [ $? -eq 0 ]
then
echo "$line"
fi
done
Lines with fewer than 6 letters are rejected. You might want to adjust
that value, as well as the character class in the sed scripts.
--
John Hasler
Reply to: