I have a directory and inside I have two file types : *.sai and *fastq and I vant to use both variable in one shell for loop:
for j in *sai *fastq
do bwa samse $j $j > ${j%.sai}.sam
done;
after command do
I want to load corresponding *.sai and *.fastq data in to the program (bwa samse). Could you help me please with syntax?
EXAMPLE:
in one directory is xx.fast xx.sai yy.fastq yy.sai
and program bwa samse need to process in one time two corresponding files - bwa samse xx.fastq xx.sai...
Many thanks for any ideas.
Try doing this with bash parameter expansion:
for j in .*sai; do
[[ -s ${j%.sai}.fastq ]] &&
bwa samse "$j" "${j%.sai}.fastq" > "${j%.sai}.sam"
done
and please, stop killing kitties with parsing ls
output. (not for you Incorigible)