首页 > 编程知识 正文

sed替换空格,sed替换文件内容

时间:2023-05-06 08:53:58 阅读:207973 作者:3915

我的配置文件中有一行如下:

server 192.168.3.66 iburst minpoll 3 maxpoll 6

我希望修改里面的ip地址改为192.168.3.123如何实现你,配置文件名为/etc/ntp.conf

#!/笑点低的跳跳糖/ship="192.168.3.123"str1=`cat /etc/ntp.conf | grep server`str2="server "$ip" iburst minpoll 3 maxpoll 6"command=s@$str1@$str2@sed -i "$command" /etc/ntp.conf

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。