Created
February 16, 2013 16:41
-
-
Save bdcravens/4967610 to your computer and use it in GitHub Desktop.
was: Invoice_000000ABCDEF012_010113.csv changeto: ABCDEF012.csv (leading zeros may change)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FILES=Invoice_*_*.csv | |
for f in $FILES | |
do | |
newname=`echo $f| cut -d'_' -f 2` | |
newnamelen=${#newname} | |
leading=$[newnamelen-9] | |
invnum=${newname:leading} | |
mv $f $invnum.csv | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment