我正在尝试替换ini文件中两个部分之间的字符串。我正在使用sed命令,我能够实现我想要的,但在执行sed命令后,它将替换文本并等待控制台中文件末尾的输入。
我的ini文件是
[platform]
security=http://security:8080/
referral=http://mindapp:8000/
catalog=http://catalog:8080/
workorder=http://workorder:8080/
assets=http://assets:8080/
provider=http://provider:8080/
[app]
name=express
ssl=false
port=8080
hostname=0.0.0.0
在上面的文件中,我试图使用下面的命令在:8080之前添加namespace.cluster.svc.local。
sed -n -e '/\[platform\]/,/\[app\]/p' | sed -e '1d;$d' | sed 's/:/\.das-ci.svc.cluster.local&/2g' secrets.ini
有什么方法可以避免在执行命令后等待吗?
3条答案
按热度按时间uqzxnwby1#
第一个命令等待stdin,执行以下操作
不过,您应该只调用
sed
一次。gzszwxb42#
使用
sed
bbmckpt73#
下面的命令工作正常。
谢谢你@f-hauri-give-up-github