0
之間卡住這個任務:grep的正則表達式對詞沒有特殊符號
我有線路,包含從組字,有些字/消化/減文本,空間和再次字從組和文字
例如詞語第一或第二:
"first-12qwe32 second-4324"
"first-123ewq first-asf-ds"
"second-123 first-45-6"
但不是:
"second-123"
"second-123 \" first-45-6"
"second-123 \t first-45-6"
"first-45-6-second-ffuu"
我試試這個:
grep -e "first-\w*\|second-\w* first-\w*\|second-\w*"
grep -e "(first-\|second-)\w* (first-\|second-)\w*
和相同的變體。
我的單詞列表受限於已知組。我如何適應您的解決方案? 嘗試 grep -e「(first \ | second)+ [ - a-z0-9] *(first \ | second)+ [ - a-z0-9] *」 does not work – 2013-03-25 14:11:33