title: Subtracting from values ending with specific digits?
body: <p>I have a .bed (.tsv) file that looks like this:</p>
  <pre><code>chr1    0   100000
  chr1    100000  200000
  chr1    200000  300000
  chr1    300000  425234
  </code></pre>
  <p>I want to perform the operation -1 from only values in column 3 that end in &quot;000&quot;, using sed or awk so that the output looks like:</p>
  <pre><code>chr1    0   99999
  chr1    100000  199999
  chr1    200000  299999
  chr1    300000  425234
  </code></pre>
  <p>Embarassingly enough, the best I've come up with is:</p>
  <pre><code>
  awk {sub(/000$/,&quot;999&quot;,$3); print $1,$2,$3}' oldfile &gt; newfile
  
  </code></pre>
  <p>which simply substituites the last 3 digits for 999, rather than actually subtracting.
  Any help is appreciated is always!</p>