bash grep newline

后端 未结 11 1751
渐次进展
渐次进展 2021-01-04 12:38

[Editorial insertion: Possible duplicate of the same poster\'s earlier question?]

Hi, I need to extract from the file:

first
second
         


        
11条回答
  •  隐瞒了意图╮
    2021-01-04 13:04

    Instead of grep, you can use pcregrep which supports multiline patterns

    pcregrep -M 'second\nthird' file
    

    -M allows the pattern to match more than one line.

提交回复
热议问题