grep pattern inluding new line character

bawi@hp:~$ cat a.txt
aaabbb
cccddd

dddbbb
xxxxxx
cccfff
bawi@hp:~$ pcregrep -M 'b\nc' a.txt
aaabbb
cccddd
bawi@hp:~$ pcregrep -M 'b(\n|.)*c' a.txt
aaabbb
cccddd

dddbbb
xxxxxx
cccfff
bawi@hp:~$ cat b.txt 
1.ERROR test1
known-pattern1
other1.1
2.DEBUG test2
some data2.1
some data2.2
3.ERROR test3
undefined
other3.1
4.ERROR test4
known-pattern2

bawi@hp:~$ pcregrep -M 'ERROR .*\n' b.txt | pcregrep -M -v '\nknown-pattern1' | pcregrep -M -v '\nknown-pattern2'
3.ERROR test3
undefined
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s