Hi Guys , I have an file containing hundreds of line as per "ORIGINAL" below , I need to move the columns as per below , Appreciate if anyone can assist me with the commands .
Original :-
UST095: ChannelElementUl 384
UST095: ChannelElementDl 160
UST073: ChannelElementUl 384
UST073: ChannelElementDl 160
UST002: ChannelElementUl 384
UST002: ChannelElementDl 160Example Change to :-
UST095 ChannelElementUl 384 ChannelElementDl 160
UST073 ChannelElementUl 384 ChannelElementDl 160
UST002 ChannelElementUl 384 ChannelElementDl 160Thanks,
Roy
Provided your data is sorted (and it looks like yours is in reverse order on field 1), this awk script should do the job. This is a break point report breaking on field 1: #!/bin/ksh awk ' { gsub(":","",$1) # get rid of the colon in field 1 if(NR == 1) { printf("%s", $0) sf=$1 next } if (sf == $1) { $1="" printf("%s", $0) } else { # terminate the previous line and start a new one printf("\n%s", $0) sf=$1 } } END { printf("\n") } ' original.txt# Let me know if you have any questions
Well, thanks for sharing. I was searching quite same thing. Now it is solved.
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |