What is the most optimal way to count the nucleotide bases of each fastq file in my directory using UNIX commands?

What is the most optimal way to count the nucleotide bases of each fastq file in my directory using UNIX commands?

3

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.


UNIX


fastq


bash

• 2.7k views

updated 1 hour ago by

0

written 5.7 years ago by

▴

20

Read more here: Source link