Ubuntu
通過終端在文件中查找英文單詞
如何通過linux命令行查找並列印文件中包含的英文單詞?
GNU grep 有以下選項:
grep --only-matching --ignore-case --fixed-strings --file /usr/share/dict/british-english-insane /path/to/file.txt
這會輸出每行一個找到的字元串。這
/usr/share/dict/british-english-insane
是 Debian 軟體包提供的詞彙表wbritish-insane
。
他,好笑!
file=/usr/share/licenses/common/GPL3/license.txt dict=/usr/share/dict/cracklib-small while read word; do grep >/dev/null -i "\<$word\>" $file && printf 'Word "%s" found in GPLv3...\n' $word done < $dict
輸出 :
Word a found in GPLv3... Word ability found in GPLv3... Word about found in GPLv3... (...)
cracklib-small 文件隨包
cracklib
http://sourceforge.net/projects/cracklib