使用標準Unix工具如何在文本文件或輸出中搜索可能有1-2個字母轉置或丟失的單詞?如何爲小錯誤grep文本
比如我輸入
function addtion(number, increment)
return number+increment
end
function additoin(number, increment)
return number+increment
end
我想在我輸入搜索addition
和匹配addtion
和additoin
,告訴我這件事。因爲它是代碼,檢查字典是不可能的。
當前cat file.txt | grep "addition"
只會讓我無所適從。
使用grep,您可以搜索詞與「廣告」或「一」開始,唯一結尾「 n'以及可能的字符集。爲此你可以做一些像'grep -En'a [dito] + n「file --color'的東西。 – blackSmith