use awk to split file on unique identifier

if you want to split your file on unique identifiers in say col. 2, and your identifiers are, for ex., CGA, CGC, CGG, and CGT,  running this one-liner will generate 4 files, named as your identifiers:

awk ‘{print >> $2 }’ input    (don’t specify output)

Leave a Reply

Your email address will not be published. Required fields are marked *