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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiline concatination 1

Status
Not open for further replies.

demis001

Programmer
Aug 18, 2008
94
US
How I can concatinate
>1
AAAAAAAAAAA
BBBBBBBBBBBBB
CCCCCCCCCCCC

To get
>1
AAAAAAAAAABBBBBBBBBCCCCCCCCCCC

I have tried the following and it only capture the first line and stops.

awk '/^>/ {print; "\t"; getline; print}' $*

 
awk '/^>/{if(FNR>1)print x;x="";print;next}{x=x $0}END{if(x>"")print x}' $*

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
OOps, sorry for the typo:
awk '/^>/{if(NR>1)print x;x="";print;next}{x=x $0}END{if(x>"")print x}' $*

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Do we have to use awk?

xargs < datafile|sed 's/ //g'

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top