Sed 中 /c 是替换的意思,可以用这个 /c 来实现查找并替换一整行的需求。
比如查找 iburst 所在的行,并把这行内容替换成自己希望的内容。
[root@ceph01 ~]# more /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
pool 2.centos.pool.ntp.org iburst
[root@ceph01 ~]# sed -i '/iburst/cserver 192.168.46.7 iburst' /etc/chrony.conf
[root@ceph01 ~]# more /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 192.168.46.7 iburst
注意,上面的命令中有 /c
标签:ntp,ceph01,查找,org,Sed,替换,pool,iburst From: https://www.cnblogs.com/yuedu/p/17035557.html