Hi everyone,
I made a short script to count the number of raw reads (fastq.gz) in my folder. The results will save in a text file (.txt).
echo "We count the number of reads for each file (fastq.gz)."
echo "file\traw_reads\ttrimmed_reads" > count_read_evolution_trim_test.txt
for f1 in *paired.fq.gz
do
echo $f1
RAW_READS=`gunzip -c $f1 | echo $((`wc -l`/4))`
echo -e "$f1\t$RAW_READS" >> count_read_evolution_trim_test.txt
done
But I obtained this error message:
./test_count_raw_reads.sh: command substitution: line 9: syntax error near unexpected token `)'
./test_count_raw_reads.sh: command substitution: line 9: `/4))'
./test_count_raw_reads.sh: command substitution: line 9: unexpected EOF while looking for matching `)'
./test_count_raw_reads.sh: command substitution: line 10: syntax error: unexpected end of file
./test_count_raw_reads.sh: line 9: -l: command not found code here
How I can fix this problem?
Thank you.
When I did this command line:
It works, I obtained the number of raw reads. I just want to put the number of raw reads in a table, like in this example.
file | raw_read_number
my_file_1 | 130000
my_file_2 | 160000
my_file_3 | 200000
I don't understand where I did a mistake.
you're piping a stream in echo : wrong
your use of ` is messing up this line:
If you watch my initial code (in the top) of this post, I put the back quote as you wrote. And I can't save the number of raw reads in my text table (count_read_evolution_trim_test.txt).
The problem in my code, that a I have two backquote in this line:
And it doesn't count the raw reads number.