Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concatination problem

Status
Not open for further replies.

demis001

Programmer
Aug 18, 2008
94
US

How can I combine the following inpute sequence as sigle line separated by tab?
data_input:

>cel-miR-49 MIMAT0000020 Caenorhabditis elegans miR-49
AAGCACCACGAGAAGCUGCAGA
>cel-miR-50 MIMAT0000021 Caenorhabditis elegans miR-50
UGAUAUGUCUGGUAUUCUUGGG

I have tried:

awk '/^>/ {print,"\t"; getline; print}' inputdata

did't work!!

Appritiate for sage guide

Dereje

 
I have succeeded just by trail and error
awk '/^>/ {printf $0 ; getline; print $0;}' input
 
Is any one explain to me why "printf" works the job I need while "print" didn't. I haven't do anything except changing print to printf. I apprciate if you do the same job with "print"

>cel-miR-49 MIMAT0000020 Caenorhabditis elegans miR-49 "\t" then sequence

Dereje
 
I'd use the following:
Code:
awk '/^>/{x=$0;getline;printf "%s\t%s\n",x,$0}' input

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
print always outputs the output record separator (contained in the ORS variable, which defaults to a line feed) after the string that it prints. printf does not.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top