Skip to content

Instantly share code, notes, and snippets.

@poeli
Last active April 3, 2018 22:03
Show Gist options
  • Save poeli/f1940fd7580aa07b6be8def423ccd68d to your computer and use it in GitHub Desktop.
Save poeli/f1940fd7580aa07b6be8def423ccd68d to your computer and use it in GitHub Desktop.
Split a multi-fasta file to single-fasta named on the basis of sequence name
#USAGE: split_multi_fasta.sh *.fasta
cat $1 | awk -F'>' '/^>/ {match($2,/^(\S+)/,a); FN=a[1]".fa"; print > FN;next;} {print >> FN; close(FN)}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment