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 Chriss Miller 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
Joined
Aug 18, 2008
Messages
94
Location
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}' $*

 
Try: awk '{ORS=""; if(++n>1) 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
 
Zedlan, yours didn't work!

 
Do we have to use awk?

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

 
Another cat-skinner:

Code:
sed -n 'H;${x;s/\n//gp;}' datafile

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top