我想打开一个文件列表,其名称存储在 .csv 文件的列中并进行调用。
这是我的metadata.csv 文件的标题和第一行:
Sample_name,file1,file2,i7_Index_Name,i7_Sequence,i5_Index_Name,i5_Sequence,Well,Set,PrimerF,PrimerR,Locus
18S-B-August-5-L2,MI_M06648_0305_001_UDP0001_i7---UDP0001_i5_18S-B-August-5-L2_R1.gz,MI_M06648_0305_001_UDP0001_i7---UDP0001_i5_18S-B-August-5-L2_R2.gz,UDP0001_i7,GAACTGAGCG,UDP0001_i5,TCGTGGAGCG,A01,1,TCGTCGGCAGCGTCAGATGTGTATAAGAGACAG,GTCTCGTGGGCTCGGAGATGTGTATAAGAGACAG,18S
这是我的脚本:
步骤 1:我选择metadata.csv 文件的第二列,该列存储所有名称(1 个名称,即 1 个文件/行) 步骤 2:我打开每个文件
COLNUM_FILE1=$( cat Desktop/output/fastqs_demultiplexed_for_DADA2/metadata.csv | cut -d ',' -f2)
"${COLNUM_FILE1}"
zsh: command too long: file1\nMI_M06648_0305_001_UDP0001_i7---UDP0001_i5_18S-B-August-5-L2_R1.gz\nMI_M06648_0305_001_UDP0002_i7---UDP0002_i5_18S-B-August-6-L1_R1.gz\nMI_M06648_0305_001_UDP0003_i7---UDP0003_i5_18S-B-August-6-L2_R1.gz\nMI_M06648_0305_001_UDP0004_i7---UDP0004_i5_18S-B-August-6-L3_R1.gz\nMI_M06648_0305_001_UDP0005_i7---UDP0005_i5_COI-A-June-4-L2_R1.gz\nMI_M06648_0305_001_UDP0006_i7---UDP0006_i5_COI-A-June-4-L3_R1.gz\nMI_M06648_0305_001_UDP0009_i7---UDP0009_i5_COI-B-June-4-L2_R1.gz
FILE1=($(awk -F',' -v COLNUM=$COLNUM_FILE1 \
'NR>1 {print $COLNUM }' "Desktop/output/fastqs_demultiplexed_for_DADA2/metadata.csv" \
sort | uniq))
我收到此语法错误(我认为是由于点)。
awk: syntax error at source line 1
context is
>>> MI_M0667292_927_UPD922_i7-----UDP928_i5_18S-August-5-L2_R1. <<<< gz
awk: bailing out at source line 1
awk: syntax error at source line 1
你有解决方案吗? rq:我使用的是 MAC OS M1 Monterey 12.6