I'm trying to write a short script that enters into a directory prints out an array of the file names without an extension in one column and the in the next column adds the extension .fna. Then exits the directory to enter the next directory.
For eg I have the file names
ERR163030.fastq
ERR163031.fastq
and I would like the out put to be:
ERR163030 ERR163030.fna
ERR163031 ERR163031.fna
This is the code I have so far.
SRA_files=(P*)
# loop that picks each directory in the array
for i in "${SRA_files[@]}"
do
#Go into directory
pushd "$i";
#Make array
fastq_names=(*.fastq);
# Exit directory
popd;
# Print in main directory containing all the sub directories
printf "%s\n" "${fastq_names[*]%.*}" "${fastq_names[*]%.*}.fna" > "$i"_names.txt
done