title: tr -d to remove an exact string of characters from a string
body: <p>I am trying to make <code>tr -d</code> remove a string of characters from an existing string, without it removing characters everywhere else.</p>
  
  <p>For example, I want <code>tr</code> to remove <code>: OK</code> from the end of every string in <code>foo.txt</code>.</p>
  
  <p>Contents of <code>foo.txt</code>:</p>
  
  <pre><code>BROKEN BONES: OK
  Kefen Odvora: OK
  BOOKS_FOR_MUM: OK
  E: OK Amded: OK
  </code></pre>
  
  <p>This is the command I run:</p>
  
  <pre><code>cat foo.txt | tr -d ": OK$"
  </code></pre>
  
  <p>I want it to output this:</p>
  
  <pre><code>BROKEN BONES
  Kefen Odvora
  BOOKS_FOR_MUM
  E: OK Amded
  </code></pre>
  
  <p>But instead I get this, which I don't want:</p>
  
  <pre><code>BRENBNES
  efendvora
  BS_FR_MUM
  EAmded
  </code></pre>
  
  <p>How can I fix this?</p>
  
  <p>Mac OS X Yosemite, bash 3.2.57(1)-release</p>