0
爲什麼echo 'word word word word word word' | sed 's/[a-zA-Z]* /DELETED /2g'
sed's/pattern/subtitution/2g'真的有用嗎?
打印word DELETED DELETED DELETED DELETED word
?
爲什麼sed沒有替代最後的word
?
爲什麼echo 'word word word word word word' | sed 's/[a-zA-Z]* /DELETED /2g'
sed's/pattern/subtitution/2g'真的有用嗎?
打印word DELETED DELETED DELETED DELETED word
?
爲什麼sed沒有替代最後的word
?
因爲你的正則表達式有尾隨空格:
/[a-zA-Z]*/
^
它明確地尋找零個或多個字母,後面加一個空格。
多麼愚蠢的問題!,謝謝@RitchieHindle。 – tarrsalah
好吧,我的經驗說,錯別字和流浪';',''是最難找到你自己的腳本。 – abasu