bash rename using regex array substitution
- by mulllhausen
hi, i have a very similar question as for this post.
i would like to know how to rename occurances within a filename with designated substitutions. for example if the original file is called: 'the quick brown quick brown fox.avi' i would like to rename it to 'the slow red slow red fox.avi'.
i tried this:
new="(quick=>'slow',brown=>'red')"
regex="quick|brown"
rename -v "s/($regex)/$new{$1}/g" *
but no love :(
i also tried with
regex="qr/quick|brown/"
but this just gives errors. any idea what im doing wrong?