zcat whatever.fastq.gz | paste - - - - | awk '{print NR " " (length($3))}'
zcat whatever.fastq.gz | wc -l | awk '{print $1/4}'
In below example, the extension changes from *.scafSeq to *.fa
for f in *.scafSeq; do mv "$f" "$(basename "$f" .scafSeq).fa"; done
rename command can also come handy in such cases. For e.g.
Rename all .fastq
files as .fasta
rename .fastq .fasta *.fastq
echo -e "seq_id\tA\tU\tG\tC"; while read line; do echo $line | grep ">" | sed 's/>//g'; for i in A U G C;do echo $line | grep -v ">" | grep -o $i | wc -l | grep -v "^0"; done; done < test.fa | paste - - - - -
grep -c "^>" file.fa
sed 's/>.*/&WHATEVERYOUWANT/' file.fa > outfile.fa
awk '{print $1}' file.fa > output.fa
for i in *.clstr; do echo $i ; grep ">Cluster" -B 1 $i --no-group-separator | paste - - | awk '{print $1"_"$2 " "$3+1}' > $i.count.txt ; done
rename 's/_fastp.fastq.gz/.fq.gz/' *.gz