fork(1) download
  1. #!/bin/bash
  2.  
  3. awk '/^<a:t>/ {
  4. sub(/^<a:t> */, ""); sub(/ *<\/a:t>/, "");
  5. sent = (sent ? sent " " : "<a:t>") $0
  6. next }
  7. sent { print sent "</a:t>"; sent="" }
  8. 1
  9. END { if(sent) print sent "</a:t>" }'
Success #stdin #stdout 0.01s 5456KB
stdin
<SOME TAGS>
<a:t>The cat</a:t>
<a:t> is</a:t>
<a:t> very</a:t>
<a:t> cute</a:t>
<SOME OTHER TAGS>
<a:t>the </a:t>
<a:t>dog </a:t>
<a:t>is </a:t>
<a:t>also </a:t>
<a:t>very </a:t>
<a:t></a:t>
<a:t>cute and nice</a:t>
<ANOTHER TAG>
stdout
<SOME TAGS>
<a:t>The cat is very cute</a:t>
<SOME OTHER TAGS>
<a:t>the dog is also very  cute and nice</a:t>
<ANOTHER TAG>