如何将一组仅具有文件名的类似文件重命名?
我有一组文件:
Ursus_fibroblast_ACT_34_CT0_adak_HJ_EV_S45_L002_R1_001_val_1.fq.gzAligned.out.sam
Ursus_fibroblast_ACT_34_CT12_adak_HJ_EV_S49_L002_R1_001_val_1.fq.gzAligned.out.sam
Ursus_fibroblast_ACT_34_CT0_adak_HJ_EV_S45_L002_R1_001_val_1.fq.gzAligned.out.sam
Ursus_fibroblast_ACT_34_CT12_adak_HJ_EV_S49_L002_R1_001_val_1.fq.gzAligned.out.sam
Ursus_fibroblast_ACT_34_CT15_adak_HJ_EV_S50_L002_R1_001_val_1.fq.gzAligned.out.sam
我只想将它们重命名,并将其重命名,以及扩展名为“ aligned.out.ut.sam”:
“ act_34_ct15_adak_hj_ev_s50”“ act_34_ct12_adak_adak_hj_ev_s49”等等。
到目前为止,我已经开始了一个脚本的开始,但是我不确定现在该做什么。...我显然是对编码的新手,因此,如果您需要更多信息,请告诉我。
files={*.sam}
for i in $files
echo $i
mv -i $i
I have a group of files:
Ursus_fibroblast_ACT_34_CT0_adak_HJ_EV_S45_L002_R1_001_val_1.fq.gzAligned.out.sam
Ursus_fibroblast_ACT_34_CT12_adak_HJ_EV_S49_L002_R1_001_val_1.fq.gzAligned.out.sam
Ursus_fibroblast_ACT_34_CT0_adak_HJ_EV_S45_L002_R1_001_val_1.fq.gzAligned.out.sam
Ursus_fibroblast_ACT_34_CT12_adak_HJ_EV_S49_L002_R1_001_val_1.fq.gzAligned.out.sam
Ursus_fibroblast_ACT_34_CT15_adak_HJ_EV_S50_L002_R1_001_val_1.fq.gzAligned.out.sam
I would like to rename them with only this part of the name plus the extension "Aligned.out.sam":
"ACT_34_CT15_adak_HJ_EV_S50" "ACT_34_CT12_adak_HJ_EV_S49" and so on.
I have a start of a script so far but I am unsure of what to do now....I am obviously new to coding so if you need more information please let me know.
files={*.sam}
for i in $files
echo $i
mv -i $i
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您的文件在同一目录中,则该命令将完成工作。
If your files are in the same directory this command will do the job.