I have searched online for 10 hours now and tried various codes, but still need help. I am attempting to merge three files using 'paste' and 'awk'. However, the columns are not adjusting to the longest string of characters. All files are formatted in the same manner as below.
- F gge0001x
- D 12-30-2006
- T 14:15:20
- S a69
- B 15.8
- M gge06001
- P 30.1
Below is my faulty code.
$ paste <(awk '{print $1}' lineid) <
(awk '{printf("%-13.10s\n", $1)}' gge0001x) <
(awk '{printf("%-13.10s\n", $1)}' gge0001y) <
(awk '{printf("%-13.10s\n", $1)}' gge0001z)
This code results in misaligned columns as pictured below.
I would greatly appreciate your help.
Input File 1
F
D
T
S
B
M
P
Q
R
U
X
A
G
H
O
C
K
W
L
Input File 2
gge0006x
12-30-2006
14:05:23
a69
15.4
gge06001
30.8
19.2
1006.2
1012.7
36.2
38.994
107.71
8.411
37.084
7.537
28.198
212.52
68.1
Input File 3
gge0006y
12-30-2006
14:05:55
a69
15.3
gge06001
30.6
21.1
1006.6
1014.6
36.1
38.994
107.71
8.433
36.705
7.621
27.623
210.51
68
Input File 4
gge0006z
12-30-2006
14:06:28
a69
15.7
gge06001
30.3
23.5
1008
1014.1
36.6
38.994
107.71
8.434
36.508
7.546
27.574
208.08
67.6
Results for paste file1 file2 file3 file4 | column -t
column
command instead of messing with the fields individually usingawk
? e.g.paste file1 file2 file3 file4 | column -t
– steeldriver Apr 21 at 16:37