簡體   English   中英

在文件中使用sed替換復雜的行

[英]Replace complex line using sed in a file

我該如何更換

/opt/IBM/WebSphere/AppServer/profiles/profileDmgr/bin/startManager.sh 

"/opt/IBM/WebSphere/AppServer/profiles/profileDmgr/bin/startManager.sh -timeout 10" 

使用sed命令

sed 's,/opt/IBM/WebSphere/AppServer/profiles/profileDmgr/bin/startManager.sh,"/opt/IBM/WebSphere/AppServer/profiles/profileDmgr/bin/startManager.sh -timeout 1",

這使用逗號而不是斜杠作為分隔符。 我將輸入和輸出留給您了。

sed 's|/opt/IBM/WebSphere/AppServer/profiles/profileDmgr/bin/startManager.sh|"& -timeout 10"|' YourFile

使用&避免重復相同的巨大模式

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM