1

I am trying to use a for loop to use multiple files for trimmomatic but the output files are kept in a different directory that has pre-installed directories with Input names. But when I am running the command, it is not able to detect the sub directories:

/home/samarpana/archive/3_Trimmomatic/Sample_x_R1.fastq (No such file or directory). 

The output directories are named as Sample_x_R1, Sample_y_R2 etc.. What has to edited so that the output directory reads only the file name and not its extension (i.e .fastq in this case).

The command that I am using is given below.

for file in *.fastq; do 
    java7 -Xmx8g -jar /opt/apps/Trimmomatic-0.30/trimmomatic-0.30.jar PE -threads 12 -phred33 /home/samarpana/archive/Project_Asthma_Exome_25062015/Fastq/$file /home/samarpana/archive/3_Trimmomatic/$file ILLUMINACLIP:/home/samarpana/scratch/adapters/TruSeq3-PE.fa:2:30:10 CROP:98 HEADCROP:3 SLIDINGWINDOW:25:20 MINLEN:50; 
done
terdon
  • 234,489
  • 66
  • 447
  • 667
SamC
  • 11
  • 3
  • just quote it probably. – mikeserv Oct 08 '15 at 10:09
  • So, is your question actually about how to [remove file extension from a string?](http://unix.stackexchange.com/questions/18765/best-way-to-remove-file-extension-from-a-string)? – steeldriver Oct 08 '15 at 10:15
  • Just use `${file%.*}` to remove the extension. See [here](http://www.tldp.org/LDP/abs/html/string-manipulation.html) and the duplicate for more information. – terdon Oct 08 '15 at 10:38

0 Answers0