In the rename
below the /path/to/folder...
is trimmed (an example is in the parenthesis. Each .bam
and .bam.bai
in that trimmed directory in the bam
sub-folder is then renamed by removing the IonCode_0000_
in the beginning of each filename, leaving just the unique id. The files are always in pairs that is there will always be a matching .bam
and .bam.bai
. The code executes correctly in ubuntu 14.04
but not in centos 7
as the files do not get renamed to the desired. I am not sure what is different as the rename
utility is there in centos 7
. The command does execute but the rename
does not happen and the file is unchaged. Thank you :).
/path/to/folder/R_2019_xx_xx_xx_xx_xx_yyyy_X1-0000-101-v0.6_xxx_xxxxx_xxxxx_xxxxx
IonCode_0000_16-1111-Last,First.bam IonCode_0001_17-0000-L,F-REPEAT.bam
IonCode_0000_16-1111-Last,First.bam.bai IonCode_0001_17-0000-L,F-REPEAT.bam.bai
mv "$RDIR" "${TRIMSTR}" ## trim folder name to (/path/to/folder/R_2019_xx_xx_xx_xx_xx_yyyy_X1-0000-101) --- this is "$TRIMSTR" ---
rename s/"IonCode_[0-9][0-9][0-9][0-9]_"/""/g "$TRIMSTR"/bam/*.bam
rename s/"IonCode_[0-9][0-9][0-9][0-9]_"/""/g "$TRIMSTR"/bam/*.bam.bai
desired
/path/to/folder/R_2019_xx_xx_xx_xx_xx_yyyy_X1-0000-101/bam
16-1111-Last,First.bam 17-0000-L,F-REPEAT.bam
16-1111-Last,First.bam.bai 17-0000-L,F-REPEAT.bam.bai
looks like centos
has util-linux rename
which doesn't support s/.../.../
but I am not sure how to adjust the rename
in the script. Thank you :).
rename -V
rename from util-linux 2.23.2