shell 如何刪除xxx{{{xxx}}}中第二對 {}?

sh/bash/dash/ksh/zsh等Shell脚本
回复
Yestare
帖子: 1
注册时间: 2015-03-16 14:14
系统: debain

shell 如何刪除xxx{{{xxx}}}中第二對 {}?

#1

帖子 Yestare » 2015-03-16 14:18

shell 如何刪除第二對 {}?
xxx{
{
{
xxx
}
}
}
头像
astolia
论坛版主
帖子: 6703
注册时间: 2008-09-18 13:11

Re: shell 如何刪除xxx{{{xxx}}}中第二對 {}?

#2

帖子 astolia » 2015-03-19 10:41

代码: 全选

$ echo 'xxx{
{
{
xxx
}
}
}
' | sed 'N;N;N;s/{\n{\n{\n/{\n{\n/g;s/}\n}\n}\n/}\n}\n/g'
回复