awk to convert dict file to table format

HI
I have a file that looks like below

abc
{Seq('GATAGC', SingleLetterAlphabet()): 1, Seq('ATAGCG', SingleLetterAlphabet()): 1, Seq('TAGCGG', SingleLetterAlphabet()): 1}
BBC
{Seq('AGGATA', SingleLetterAlphabet()): 1, Seq('GGATAG', SingleLetterAlphabet()): 1, Seq('GATAGC', SingleLetterAlphabet()): 1, Seq('ATAGCG', SingleLetterAlphabet()): 1, Seq('TAGCGG', SingleLetterAlphabet()): 1}
CCB
{Seq('GACGGA', SingleLetterAlphabet()): 1, Seq('ACGGAT', SingleLetterAlphabet()): 1, Seq('CGGATA', SingleLetterAlphabet()): 1, Seq('GGATAG', SingleLetterAlphabet()): 1, Seq('GATAGC', SingleLetterAlphabet()): 1, Seq('ATAGCG', SingleLetterAlphabet()): 1, Seq('TAGCGG', SingleLetterAlphabet()): 1}

I wanted to get something like:

abc GATAGC
abc ATAGCG
abc TAGCGG
BBC AGGATA
---------------

I have been trying to get the solution in python but wth less success. Is there any easy way to do it in awk?

Welcome biofreek,

Of course there is a way to do what you want in just about every programming language, including awk .

However, our mission here is to help you help yourself and your mission here is to show all your work and your scripts and what you have written (tried) and any and all error messages you experienced.

how about:

awk -F"'" 'FNR%2{f1=$0;next} {for(i=2;i<=NF;i+=2) print f1, $i}' myFile
1 Like