hi gurus ,
i want the command to get the output in the desired format .
basically to convert columns to rows.
please refer to the attachment.
hi gurus ,
i want the command to get the output in the desired format .
basically to convert columns to rows.
please refer to the attachment.
If your input is tab separated text file then try, if xls then convert it to tab and then use
$ awk 'NR==1{for(i=5;i<=NF;i++){gsub(/\(|\)/,OFS,$i);A=$i}}NR>1{s=$1 OFS $2 OFS $3 OFS $4;for(i=5;i<=NF;i++)print s,A,$3,$4,$i}' FS='\t' OFS='\t' file
S1 P1 1 DISTI USD 1 265.2
S1 P1 1 MSRP USD 1 312
S1 P1 1 DIST EUR 1 195.5
S1 P1 1 MSRP EUR 1 230
.....
.....
S2 P2 3 4 DISTI GBP 3 4 648.55
S2 P2 3 4 MSRP GBP 3 4 763
Thanks for the reply .. i just need to tweakur your query .. can u plz explain a bit how looping works in your command
Duplicate here
Urgent ! | Unix Linux Forums | Shell Programming and Scripting
I will not answer you, here all are volunteer, none of them get paid if they answer you. but still they are spending their time to help others try to understand. You are member since 2009, what you have tried so far ? what you could learn from forum ?
If you have enough forum bits post in Emergency UNIX and Linux Support Forum, or else wait for sometime.