title: bash: substract constant number after prefix
body: <p>I have a large text file with many entries like this: </p>
  
  <pre><code>                     /locus_tag="PREFIX_05485"
  </code></pre>
  
  <p>including the empty spaces in the beginning. Unfortunately, the first identifier does not start with <code>00001</code>.</p>
  
  <p>The only part in this line that is changing is the number. </p>
  
  <p>I would like to change the PREFIX (this I can do easily with <code>sed</code>), but I also want to decrease the number so it looks like this: </p>
  
  <pre><code>                     /locus_tag="myNewPrefix_00001"
  </code></pre>
  
  <p>(the next entry should be <code>..."myNewPrefix_00002"</code> and so on). Alternatively, the entry could also be without leading zeros. </p>
  
  <p>As far as I know, <code>sed</code> cannot calculate (like substracting a constant number). Any ideas how I can solve that?</p>
  
  <p>Thank you very much. If the question is unclear, please let me know and I will try to improve it.</p>
  
  <p>EDIT: Sometimes the same number occurs twice (this should also be the case in the modified file, for instance</p>
  
  <pre><code>                     /locus_tag="PREFIX_12345"
                       /locus_tag="PREFIX_12345"
                       /locus_tag="PREFIX_12346"
                       /locus_tag="PREFIX_12347"
  </code></pre>
  
  <p>should be in the end</p>
  
  <pre><code>                     /locus_tag="myNewPrefix_00001"
                       /locus_tag="myNewPrefix_00001"
                       /locus_tag="myNewPrefix_00002"
                       /locus_tag="myNewPrefix_00003"
  </code></pre>