I use a utility called "mmv". How you install "mmv" depends on what linux distribution you use (or whatever OS you use...you say "Unix", which suggests you're not using Linux).
For example, with Debian it's simply
Code:
apt-get install mmv
For your purposes, a way to do it could be:
Code:
mmv "ENCD_213_E-DM_*_A01.*" "#l1.#l2"
mmv "ENACT_215_E_DM_CCA_*_*.*" "#l1.#l3"
The basics for using mmv are:
mmv "sourcepattern" "destpattern"
The sourcepattern is pretty intuitive - you use * to match any number of characters, and ? to match any single character.
Then, imagine numbering each wildcard from left to right:
Code:
ENACT_215_E_DM_CCA_*_*.*
1 2 3
This lets you map output in the destpattern using #1, #2, #3, and so on. Additionally, you can convert to lowercase with #l1, #l2, #l3, and so on; you can convert to uppercase with #u1, #u2, #u3, and so on.
When you run mmv, it will test the destination files before doing anything. If there are any name collisions, it will FAIL SAFE! It will do no changes to any files, and it will give you an error saying there were destination name collisions.
That is, to me, the killer feature of mmv. You can use it with confidence that you won't lose files because renamed files overwrote. And you won't have to worry about some fancy script messing up in the middle of things, leaving some files renamed and others not renamed.
Basically, mmv is a wonderful little tool for these tasks.