我有多个 fasta 文件,其中第一行总是包含>带有多个单词的 a,例如:
File_1.fasta:
>KY620313.1 Hepatitis C virus isolate sP171215 polyprotein gene, complete cds
File_2.fasta:
>KY620314.1 Hepatitis C virus isolate sP131957 polyprotein gene, complete cds
File_3.fasta:
>KY620315.1 Hepatitis C virus isolate sP127952 polyprotein gene, complete cds
我想sP*从每个文件中取单词并将每个文件重命名为这个字符串(例如:File_1.fasta 到 sP171215.fasta)。到目前为止,我有这个:
$ for match in "$(grep -ro '>')";do
fname=$("echo $match|awk '{print $6}'")
echo mv "$match" "$fname"
done
但它不起作用,我总是得到错误:
grep:警告:递归搜索标准输入
我希望你能帮帮我!