开发者

Using sed to find a folder directory in a file and replacing with another directory

开发者 https://www.devze.com 2023-03-18 15:57 出处:网络
So I am trying to use a simple sed command in shell to find and replace a certain string in my bash file for an alias.

So I am trying to use a simple sed command in shell to find and replace a certain string in my bash file for an alias.

The alias is something like:

alias configure='cd /opt/Test/conf/server'

I want to replace /opt/Test/conf/serv开发者_如何学运维er with /opt/Test/conf but am having difficulties with the syntax.

Thanks for any help.


cat my_bash_file.sh | sed 's#/opt/Test/conf/server#/opt/Test/conf#g'
0

精彩评论

暂无评论...
验证码 换一张
取 消