Sample Header Ad - 728x90

How does pcregrep works?

0 votes
1 answer
2082 views
I have a file:
This error
-this
-this
-that
[text I want]
This error
-asd
-asfag
-adsfhs
[text I want]
[text I want]
This error
-asdgsda
-asdgg
-gasdg
I want to match to match except This error and next three lines, I can use: pcregrep -vM 'This error\n.*\n.*\n' file It gives output:
[text I want]
[text I want]
[text I want]
However, instead of removing them if I want to match them using the same command(by removing v): pcregrep -M 'This error\n.*\n.*\n' file It gives output:
This error
-this
-this
This error
-asd
-asfag
This error
-asdgsda
-asdgg
So how does pcregrep actually works?
Asked by Prvt_Yadav (6032 rep)
Jul 16, 2019, 05:01 AM
Last activity: Jul 16, 2019, 06:26 AM