Chinaunix

标题: sed去掉[]中的空格 [打印本页]

作者: mwl326    时间: 2013-03-18 17:02
标题: sed去掉[]中的空格
我有一个日志文件里面的格式大概是:
aaa aaa aaa fff ggg [sds ddf ggg gg] ss ee ggg [ss  ff  gg]

我怎么用sed吧[]括号里面的空格去掉,其他空格不去掉。
作者: mwl326    时间: 2013-03-18 17:18
帮帮忙~~~~
作者: uarenotalone    时间: 2013-03-18 21:19
本帖最后由 uarenotalone 于 2013-03-18 21:19 编辑

阿,,shell已经是去年看的了,一年没有碰,
建议你发到shell版里。那里面牛人比较多
有答案了,来这说一声阿
作者: uarenotalone    时间: 2013-03-19 13:00
回复 1# mwl326


    http://bbs.chinaunix.net/thread-4072419-1-1.html
自己去看吧。。第一个回答的能做出来
作者: moperyblue    时间: 2016-10-06 22:02

  1. sed -r ':a;s/(\[[^]]*)\s/\1/;ta'
复制代码





欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2