I have text lines like below in a file :

Xpipe_in_1__gh34_dyin pipe_in_1__gh34_dyin:CK pipe_in_1__gh34_dyin:D pipe_in_1__gh34_dyin:QB pipe_in_1__gh34_dyin:RB DGRM1XCD

Xpipe_in_1__gh34_dxin pipe_in_1__gh34_dxin:CK pipe_in_1__gh34_dxin:D pipe_in_1__gh34_dxin:QB pipe_in_1__gh34_dxin:RB DGRM1XCD

Xpipe_in_2__gh34_dyin pipe_in_2__gh34_dyin:CK pipe_in_2__gh34_dyin:D pipe_in_2__gh34_dyin:QB pipe_in_2__gh34_dyin:RB DGRM1XCD . . .

So basically I want to extend each line by appending the string before the ":" mark (i.e. pipe_in_2__gh34_dyin) each line with like below :

Xpipe_in_1__gh34_dyin pipe_in_1__gh34_dyin:CK pipe_in_1__gh34_dyin:D pipe_in_1__gh34_dyin:QB pipe_in_1__gh34_dyin:RB pipe_in_1__gh34_dyin:VDD pipe_in_1__gh34_dyin:VSS pipe_in_1__gh34_dyin:AVDD DGRM1XCD

note that the appended text for this is "pipe_in_1__gh34_dyin:VDD pipe_in_1__gh34_dyin:VSS pipe_in_1__gh34_dyin:AVDD" between ":RB" and "DGRM1XCD"

How can I achieve this with sed ?

Thanks in advance ranaya

0 Answers