I can't use the trimmomatic -trimlog output because it severely slows down the process and I just want to save the summary statistics. The statistics show up as the stdout on the terminal window but I cannot figure out how to save that to my own output file in my bash script.
#!/bin/bash
for files in .
do
java -jar /path/to/trimmomatic-jar SE -phred33 ${files} ${files%%.fastq}_trimmed.fastq ILLUMINACLIP:/path/to/trimmomatic/adapters.fa:2:30:10 SLIDINGWINDOW:4:20 > log.txt
done
Using > log.txt at the end does not work, neither did: command | tee log.txt nor did command >> script log.txt nor did command 2& > log.txt
Anyone have any ideas?
&>>
appends STDOUT and STDERR to the same file. You might benefit from not mixing stuff up and piping2>file.err 1>file.out
Agreed. Once you start using pipes (and you will/should for larger NGS data) this
&>>
will likely eventually corrupt your output files. Go with the suggestion of Wouter using2>
.If an answer was helpful, you should upvote it; if the answer resolved your question, you should mark it as accepted. You can accept more than one answer if they all work.