My grep command is it:
grep -Pzo -a 'Start(.*\n)*?.*?End' testfile.txt
And testfile.txt contains:
ItsTestStartFromHereEndNotVisibleStartFrom
HereEndOkNotVisible
the output:
$ grep -Pzo -a 'Start(.*\n)*?.*?End' testfile.txt
StartFromHereEndStartFrom
HereEnd
It works fine, but when null character exists between "Start" and "End", it does not work. I know it's because I have used "-z" option, but I need it for multi-line support.
For example, it's my content with null character:
ItsTestStartFrom[\x00]HereEndNotVisibleStart[\x00]From
HereEndOkNotVisible