This one prints between the two patterns
printf "/n"| openssl s_client -showcerts -connect www.google.com:443 | awk '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/'
Then this one removes the first matching set but then prints all the superfluous junk
printf "/n"| openssl s_client -showcerts -connect www.google.com:443 | awk '/-----BEGIN CERTIFICATE-----/{f=1;++c} !(f && c==2); /-----END CERTIFICATE-----/{f=0}'
I would like to get the second results with out the extra stuff outside the pattern matches I could by just using two awks.
printf "/n"| openssl s_client -showcerts -connect www.google.com:443 | awk '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/' | awk '/-----BEGIN CERTIFICATE-----/{f=1;++c} !(f && c==2); /-----END CERTIFICATE-----/{f=0}'
But I wanted to do it in one if it is possible.