Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
いくつかのオプションの特殊文字で始まり、その後に続くすべての行を削除しようとしましたblubb:
blubb
それは私が一致させたい行です:
#ブラブ *ブラブ -ブラブ ブラブ
それはそれを行うはずですが、機能しません:(
sed "/^.?blubb$/d" -i special.conf sed "/^[#*-]?blubb$/d" -i special.conf
誰かが正しい解決策を持っていますか?
次の sed コマンドを使用します。
sed -i.old '/^[#*-]\{0,1\}blubb/d' special.conf
また
sed -i.old -E '/^[#*-]?blubb/d' special.conf
sed -i.old -r '/^[#*-]?blubb/d' special.conf