Should be fairly easy. The "rename" command may or may not do what you want it to do - I've found it to vary wildly between different distros. See what "man rename" says. However, otherwise you should be able to run this:
Code:
for i in WFI_FM1*.txt; do
mv $i $(echo $i | sed 's/_R\(_[^_]\+_[^_]\+_[^_]\+.txt\)$/\1/')
done;
I don't know exactly what defines the archives' names, but these are the assumptions I've made:
- They all begin with WFI_FM1 and end in .txt
- The _R that you want to remove is followed by "_<some characters>_<some characters>_<some characters>.txt".
If these two are true, then the code should do what you want it to do. Hope this helps,