sed数据处理请教
时间:2011-07-07
来源:互联网
# default: off
# description: The rsync server is a good addition to an ftp server, as it \
# allows crc checksumming etc.
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args --daemon
log_on_failure + USERID
}
disable = no 我想把它全局替换成disable = yes 该怎么写呢,我说的是全局,而不是指定第几行号替换
# description: The rsync server is a good addition to an ftp server, as it \
# allows crc checksumming etc.
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args --daemon
log_on_failure + USERID
}
disable = no 我想把它全局替换成disable = yes 该怎么写呢,我说的是全局,而不是指定第几行号替换
作者: ibelieveme 发布时间: 2011-07-07
本帖最后由 MaskRay 于 2011-07-07 12:38 编辑
ed file <<< $'s/disable\\(.*\\)=\\(.*\\)no/disable\1=\2yes/\nw'
code 吃 $ 的?
ed file <<< $'s/disable\\(.*\\)=\\(.*\\)no/disable\1=\2yes/\nw'
code 吃 $ 的?
作者: MaskRay 发布时间: 2011-07-07
本帖最后由 南极雨 于 2011-07-07 13:14 编辑
回复 ibelieveme
sed 's/disable = no/disable = yes/g' file
回复 ibelieveme
sed 's/disable = no/disable = yes/g' file
作者: 南极雨 发布时间: 2011-07-07
回复 南极雨
不行无法替换
不行无法替换
作者: ibelieveme 发布时间: 2011-07-07
回复 ibelieveme
你指的不是这样的么?
复制代码
你指的不是这样的么?
- echo 'service rsync
- {
- disable = no
- socket_type = stream
- wait = no
- user = root
- server = /usr/bin/rsync
- server_args --daemon
- log_on_failure + USERID
- }' |sed 's/disable = no/disable = yes/g'
- service rsync
- {
- disable = yes
- socket_type = stream
- wait = no
- user = root
- server = /usr/bin/rsync
- server_args --daemon
- log_on_failure + USERID
- }
作者: yinyuemi 发布时间: 2011-07-07
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28