Sed : print all lines after match

前端 未结 5 1461
-上瘾入骨i
-上瘾入骨i 2020-12-14 10:46

I got my research result after using sed :

zcat file* | sed -e \'s/.*text=\\(.*\\)status=[^/]*/\\1/\' | cut -f 1 - | grep \"pattern\"

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-14 11:23

    The seldom used branch command will do this for you. Until you match, use n for next then branch to beginning. After match, use n to skip the matching line, then a loop copying the remaining lines.

    cat file | sed -n -e ':start; /pattern/b match;n; b start; :match n; :copy; p; n ; b copy'
    

提交回复
热议问题