bash - remove improper words
I have a file with bunch of words in which many of them don't make much sense such as 'completem开发者_如何学Goakes
' or even #s mixed with letters/words
. What I need is to use a tool to spell check them, if it exists on the dictionary leave it, if not delete it.
What would be a good way of doing this in bash?
Thanks
You can script Aspell.
I had some fun with getting a single quote character in here, but hey, it should be as hard to read as it was to write, right? (assuming your words are listed in words.txt)
awk 'system("grep -i -q " "'"'"'^"$0"$'"'"'" " /usr/share/dict/words") == 0 {print $0};' words.txt
精彩评论