0

I am trying to combine a matched set of files with a For loop through a directory of files.

The files look like samename.csfasta and samename.qual, only the extensions are different.

The command to execute the program is:

solid2fastq samename.csfasta samename.qual -o samename

I have been looking for an example online but haven't found one.

if there were only one input:

for f in $FILES
do
     echo "Processing $f file....."
     solid2fastq $f -o $f

done

TIA

2
  • i don't understand. what does the input to the script look like? what is $FILES? Commented May 29, 2013 at 19:19
  • So at the beginning of the script I direct it to the folder with the files. FILES=~/folder/folder/* I didn't include that sorry. Using the answer from pipi, I cd into the directory with the files in the script. Commented May 29, 2013 at 19:35

1 Answer 1

2

If the files (.cfasta and .qual) are coupled then a code like the following

FILES=( *.csfasta )
for f in "${FILES[@]}"
do
  base=$(basename "$f" .csfasta)
  echo "Processing $f file....."
  solid2fastq "$f" "${base}.qual" -o "$base"
done

should be useful.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.