Entering edit mode
10 months ago
cabraham03
▴
30
I have multiples files
genome_1.fasta
genome_1_R1.fastq
genome_1_R2.fasta
genome_2.fasta
genome_2_R1.fastq
genome_2_R2.fasta
genome_2.fasta
genome_2_R1.fastq
genome_2_R2.fasta
I want to move the files with the same base name to a folder that correspond to each genome name, I mean all genome_1* (fasta and fastq) files will be moved to genome_1/ folder
if I make it for fasta first, and then for fastq, I have no problems
for f in *.fasta; do dir="${f%.fasta}"; mkdir $dir; mv "$f" "$dir"; done
it will create the folder and move all fasta to it now all fastq
for f in *.fastq; do dir="${f%_R*.fastq}"; mv "$f" "$dir"; done
how can I use a single loop to move .fasta, _R1.fastq and _R2.fastq ???
it possible to add multiples patterns for dir variable ? something like:
dir="${f%[.fasta\|_R1.fastq\|_R2.fastq]}"
Thanks
thanks !!!!