How to use Bash script to loop through two files

后端 未结 3 1707
时光取名叫无心
时光取名叫无心 2020-12-06 21:59

I have a file (file_in.txt) containing these names:

aphid_splitseq.1.fasta.annot.xml
aphid_splitseq.2.fasta.annot.xml
aphid_splitseq.3.fasta.ann         


        
3条回答
  •  清歌不尽
    2020-12-06 22:29

    As long as both your lists are just repetitions of the same kind of name with successive numbers, you shouldn't iterate over files at all. Instead, just count a variable and use that in whatever command you want executed at each step. Example:

    COUNT=1
    while [ $COUNT -lt 5 ]; do
      mv inputfile$COUNT outputfile$COUNT
      let COUNT++
    done
    

提交回复
热议问题