我有这样的日志:
#110110 styles for content editor
Merge branch 'develop' into 'master'
Merge branch 'develop' of gitlab:bitrix/sales into develop
Merge branch 'task-110397' into develop
fix img
Merge branch 'task_110110' into develop
#110110 add content editor styles
Merge branch 'develop' into 'master'
Merge branch 'develop' of gitlab:bitrix/sales into develop
Merge branch 'develop' into 'master'
我只想从'Merge branch 'develop'
的第一次出现打印到'#master;'`到第二次。
我试过了:
sed -n -e '/\x27develop\x27\sinto\s\x27master\x27/,/\x27develop\x27\sinto\s\x27master\x27/ p'
但我无法在此代码中插入出现的内容。
答案 0 :(得分:0)
使用GNU sed:
s="Merge branch 'develop' into 'master'"
sed -n "/$s/,/$s/{1,/$s/p}" file
输出:
Merge branch 'develop' into 'master' Merge branch 'develop' of gitlab:bitrix/sales into develop Merge branch 'task-110397' into develop fix img Merge branch 'task_110110' into develop #110110 add content editor styles Merge branch 'develop' into 'master'