我的文件格式为:
first_filename_R1_001.fastq.gz
first_filename_R2_001.fastq.gz
second_filename_R1_001.fastq.gz
second_filename_R2_001.fastq.gz
etc
我正在尝试在脚本中将每个组的 R1 和 R2 版本配对在一起。然而,我在删除后缀时遇到了困难。
for i in /directory/*_R1_*;do
echo "$i"
j=${i%"$R1_001.fastq.gz"}"R2_001.fastq.gz"
echo "$j"
done
我想得到什么:
/directory/first_filename_R1_001.fastq.gz
/directory/first_filename_R2_001.fastq.gz
...
我实际得到的是:
/directory/first_filename_R1_001.fastq.gz
/directory/first_filename_R1_001R2_001.fastq.gz
...
似乎由于某种原因仅删除了扩展名。有人可以帮我吗?