I have following patterns in a text file.
######################
# ADD=123 New Comment
######################
if ($ADD==123)
Out of this, the following lines are variable
# ADD=124 Old Comment
if ($ADD==1234)
I tried pcregrep for multiline greping, but I am not good with regex. Any pointers how to extract this patterns.
[root@srv admin]# pcregrep -M '######################\n#*\n' text.php
With sed: