How can extract the lines between two patterns which are not unique ?
data of type samplex name a property b data of type samplex name c property d data of type samplex name e property f data of type sampley name g property h
I want to search between the pattern "data of type samplex" and get all occurrences of the lines between them.
First occurrence:- name a property b Second occurrence:- name c property d Third occurrence:- name e property f
For getting the first occurrence alone and when the two patterns are different,
sed '/pattern1/,/pattern2/p;/pattern2/q' <file> will work.
How can I tweak this command for my requirement?