Delete line breaks and extra spaces between patterns

Hi, if in between strings "<section" and "</section>" across multiple lines there occurs the string "ole-present", delete all line breaks and replace any tabs or multiple spaces with a single space. Looking for an AWK or SED solution. Thank you.

<section ...
    status = "ole-present"
    ...
    ...     ... ...
    ...</section>

<section ...
    status = "ole-absent"
    ... ...
    ... 
    ... ...
    ...</section>

<section ... status = "ole-present"
    ...
    ... ...
    ...</section>

<section 
    ... 
    status = "ole-present"
    ...
    ... ...
    ... 
    ...</section>

should change to:

<section ... status = "ole-present" ... ... ... ... ...</section>

<section ...
    status = "ole-absent"
    ... ...
    ... 
    ... ...
    ...     ... ...
    ...</section>

<section ... status = "ole-present" ... ... ... ...</section>

<section ... status = "ole-present" ... ... ... ... ...</section>

try:
awk '

{l=l ":lb:" $0;
 if ($0 ~ /< *\/ *section>/) {
   sub("^:lb:","",l); sub("^:lb:","",l); sub("^:lb:","",l);
   if (l ~ /ole[-]present/) gsub(":lb:","",l);
   gsub(":lb:","\n",l);
   print l; print ""; l=""}
}
' infile
1 Like

Thank you rdrtx1. I've used this. Appreciate your help.