Results for "awk"

Wire posts

  • Fasta sequence length: awk '/^>/ {if (seqlen){print seqlen}; print ;seqlen=0;next; } { seqlen += length($0)}END{print seqlen}' file.fa #Length #Linux #OneLiner

    2652 days ago

  • To clean up a fasta file so only first column of the header is outputted:$ awk '{print $1}' file.fa > output.fa #Sed #Clean #Header #Fasta

    2564 days ago

  • Rename/number the multi-fasta file in ascending order. $ awk '/^>/{print ">" ++i; next}{print}' < Mix_assembly.fasta > Mix_assembly2.fasta #awk #oneliner

    2532 days ago

  • Count the number of bases in fasta file. grep -v ">" file.fasta | wc | awk '{print $3-$1}' #Fasta #Count #Bases

    2501 days ago

  • Replace space with tab. $ awk -v OFS="\t" '$1=$1' file1 #tab #space #replace #awk

    2455 days ago

  • Remove duplicated lines from text file. $ awk '!seen[$0]++' allIds #duplicate #lines #remove #awk

    2453 days ago

  • Get the reads in fastq file: awk '{s++}END{print s/4}' file.fastq #reads #count #ngs #fastq

    2363 days ago

  • Remove the fasta with zero size: awk 'BEGIN {RS = ">" ; FS = "\n" ; ORS = ""} $2 {print ">"$0}' input.fas > output.fas #fasta #remove

    2338 days ago

  • Remove duplicate fasta ids: awk '/^>/{f=!d[$1];d[$1]=1}f' in.fa > out.fa #duplicate #fasta #ids

    2330 days ago

  • awk 'BEGIN {RS = ">" ; FS = "\n" ; ORS = ""} {if ($2) print ">"$0}' all_p_ctg.fa > all_p_ctg_CORRECTED.fa #remove #empty #clean #fasta

    2327 days ago