I have a bunch of fastq files, and I need to write a one line UNIX command that will write the word count (wc) of how many nucleotides EACH file contains, not the total. It should look like this:
321903 1.fastq 314156 2.fastq 13515 3.fastq ...
and so on.
So far I have
cat *.fastq | awk 'NR%4 == 2 {print $0}'| tr -d '\n' | wc -c
but that doesn't work. I can't find the answer this specific anywhere.
I guess you just need to run the command on individual files, in a loop, instead of *.fastq, to get the counts per sample. Other than that I don't see anything wrong.
I am using this command to find nucleotide sequences:
*.fastq; do echo -n ${file}; grep -o [actgnACTGN] $file | wc -l; done;
however, I am getting this error:
-bash: syntax error near unexpected token `do'
please guide how to resolve this issue
That is not a valid for loop. You have no "for" in it. Just copy any of the code suggestions here properly.