I am implementing a multiline search in UNIX using 'pcregrep'. I want the matching to stop at the 1st occurrence.
e.g. if i have below text in a file:
mynameishin
hahahain
internetin
fdhsufsdhuiain
djbssdvbsbsduiain
sduigsyubsuvasdyivsyifvasin
I want to print till the 1st occurrence of 'ain' after 'name'. So i need to print only:
mynameishin
hahahain
I am executing:
pcregrep -M 'name.*ain' *.txt
However I am getting the output as:
mynameishin
hahahain
internetin
fdhsufsdhuiain
djbssdvbsbsduiain