title: How to delete everything between two :'s, but not if between {}'s?
body: <p>I have a text file like this:</p>
  
  <pre><code>This is {an example} of : some of the: text.
  This is yet {another : example :} of some of the text.
  :This: is :still :yet another {:example:} of :some text:.
  </code></pre>
  
  <p>I need to delete any text found inside any <code>:</code>'s, including the <code>:</code>'s, but not if they fall inside a pair of <code>{</code> and <code>}</code>.</p>
  
  <ul>
  <li>Anything between a <code>{</code> and <code>}</code> is safe, including <code>:</code>'s.</li>
  <li>Anything not between a <code>{</code> and <code>}</code> but found between <code>:</code> and <code>:</code> is deleted.</li>
  <li>The <code>:</code>'s found outside <code>{</code> and <code>}</code> are all deleted.</li>
  </ul>
  
  <p>The output would look like this:</p>
  
  <pre><code>This is {an example} of  text.
  This is yet {another : example :} of some of the text.
   is yet another {:example:} of .
  </code></pre>
  
  <ul>
  <li>There is only one set of braces per line.</li>
  <li>The paired braces are never split across lines.</li>
  <li>There could be any number of <code>:</code>'s on the line, inside or outside the braces.</li>
  <li><code>:</code>'s always come in pairs.</li>
  </ul>
  
  <p>How can I delete everything between colons, including the colons themselves, but not when protected by braces?</p>
  
  <p>My best attempt so far is to use <code>awk -F"{" '{ print $1 }' &gt; file1.txt</code>, <code>awk -F"{" '{ print $2 }' &gt; file2.txt</code>, etc. to split the lines around the braces into different, run <code>sed</code> on the specific files to remove the parts, but not on the files containing the data inside the braces, then to assemble it back together with <code>paste</code>, but this solution is far too complicated.</p>