Replace numbers in a file name in unix (BASH)
<p>I have multiple files approximately 150 and there names do not match a requirement of a vendor. example file names are:</p>

<pre><code>company_red001.p12 
company_red002.p12
.
.
.
.
company_red150.p12
</code></pre>

<p>I need to rename all files so that 24 is added to each number sequentially and that there are no preceding zero's and that the company_ component is removed.</p>

<pre><code>red25.p12
red26.p12
red27.p12
.
.
.
red150.p12
</code></pre>

<p>I have used a <em>for</em> loop in bash to remove the <em>company_</em> component but would like something that executes all changes simultaneously as I have to perform this at a moments notice.</p>

<p>example:</p>

<pre><code>#!/bin/bash

n = 24

for file in company_red*

do

  new_name=$file$n
  n=$(($+1))
  mv -i $file $new_name

done
</code></pre>

<p>example 2</p>

<pre><code>#!/bin/bash

for f in company_red*

do mv "$f" "${f/company_red/red}";

done
</code></pre>