bash – 如何在使用sed的一行之后插入换行符/换行符

花了我一段时间来弄清楚如何做到这一点,所以发布,以防其他人都在寻找相同的。
为了在模式之后添加换行符,您还可以说:
sed '/pattern/{G;}' filename

报价GNU sed manual

G
    Append a newline to the contents of the pattern space,and then append the contents of the hold space to that of the pattern space.

编辑:

顺便说一下,这恰好在sed one liners

# insert a blank line below every line which matches "regex"
 sed '/regex/G'

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...