我在bash: insert a line after a pattern using gawk
上发布了一个问题如何在包含模式的行后面插入多行?
答案 0 :(得分:1)
将您的照片拼接在一起,如awk '<condition>{print $0; print "222"; print "223"; print "224"}
或使用换行符:
awk '<condition>{print $0"\nthis is a line\nthis is a secondline\nthis is a thirdline"}
答案 1 :(得分:1)
我将<li ng-repeat="item in narrow.searchedMenu.description | filter: narrow.chickenFilter track by $index">
{{ narrow.searchedMenu.name[$index] }},
{{ narrow.searchedMenu.short_name[$index] }},
{{ narrow.searchedMenu.description[$index] }}</li>
从222修改为nm1
以一次添加多行(该命令来自原始帖子的答案)
222\\n333
输出:
awk '1; $1==nm2 && !a++ {print nm1}' nm1=222\\n333 nm2=22 file