Bash rename files with underscore <p>I have files that are named CULT_2009_BARRIERS_EXP_Linear.dbf<br> and would like to rename them to CULT_BARRIERS_EXP_Linear.dbf . The files have a date prefixed with them which is always different showing when it was captured. I have tried to replace them with regular expressions. i want to test the string if it contains numbers and then rename. I have used</p> <pre><code> if [[ $file =~ [0-9] ]]; then rename -v "s/[0-9]//g" * &amp;&amp; rename -v s/[_]_/_/ *; </code></pre> <p>which partially works. But I would ideally like to have one rename command as it is good practice </p>