I has a text file. Now, I want expand vertical data to be horizontal as Exp1
& Exp2
. What should I do?
This is my input:
0000000 aa______ 50 F 91
0000000 aa______ 50 F 59
0000000 aa______ 50 F 20
0000000 aa______ 50 F 76
0000001 bb______ 50 F 46
0000001 bb______ 50 F 39
0000001 bb______ 50 F 8
0000001 bb______ 50 F 5
0000003 cc______ 26 F 30
0000003 cc______ 26 F 50
0000003 cc______ 26 F 71
0000003 cc______ 26 F 36
0000004 dd______ 40 M 58
0000004 dd______ 40 M 71
0000004 dd______ 40 M 20
0000004 dd______ 40 M 10
Exp1: I want to have the desired output result as below. Here the key used are the first four words in the data. The rest of the values are put on a single line.
00000000 aa______ 50 F 91 59 20 76
0000001 bb______ 50 F 46 39 8 5
0000003 cc______ 26 F 30 50 71 36
0000004 dd______ 40 M 58 71 20 10
Exp2: Same as above, however, here the values are divided into two separate lines (with the same key words):
0000000 aa______ 50 F 91 59
0000000 aa______ 50 F 20 76
0000001 bb______ 50 F 46 39
0000001 bb______ 50 F 8 5
0000003 cc______ 26 F 30 50
0000003 cc______ 26 F 71 36
0000004 dd______ 40 M 58 71
0000004 dd______ 40 M 20 10