This awk
prints second section:
cat file
start
1 data
end
not this
start
2 more data
end
not here
awk '/start/ {f=1;a++} f && a==2; /end/ {f=0}' file
start
2 more data
end
It the file has more start
than end
this counts group of start/end
cat file
start
start
1 data
end
not this
start
2 more data
end
not here
awk '/start/ {f=1} f && a==1; /end/ {if (f) a++;f=0}' file
start
2 more data
end