This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Changing format using awk command

I am trying to convert tab limited "name-seq" format to ">name \n seq\n". I think I can use "awk" function will do the job, but need your help. Thanks for your help!

For example,

From;

CHP2_ABL1_1 ACGACAAGTGGGAGATGGAAC

CHP2_ABL1_2 TAACTAGTCAAGTACTTACCCACTGAAA

TO;

>CHP2_ABL1_1
ACGACAAGTGGGAGATGGAAC

>CHP2_ABL1_2
TAACTAGTCAAGTACTTACCCACTGAAA

sequence

1 answer

Yes, oh my gawk

gawk -F'\t' '{print ">"$1"\n"$2}' your.tsv

Thanks a lot! I need to take some time and learn gawk. It seems really useful tool.

It is really easy and quick tool for transforming table-like data. I use it a lot. But beware, not to be so short to the level of cryptic. You will curse yourself in the future :D Consider mark my answer "accepted" by the way

I will keep that in mind. Your answer "accepted".

Log in to answer this question.