I have two files.
file1 has the data like belowing containing only one column.
112.319
108.915
105.512
file2 has the data like belowing containing eight columns.
0.000000 0.000 0.000 0.000 0.000 0 0.0001.0000E+20
0.000000 0.000 0.000 0.000 20.000000 0 0.0001.0000E+20
0.000000 0.000 0.000 0.000 20.000000 0 0.0001.0000E+20
I want to replace the first column of file2 with the first column of file1 and the output would be
112.319 0.000 0.000 0.000 0.000 0 0.0001.0000E+20
108.915 0.000 0.000 0.000 20.000000 0 0.0001.0000E+20
105.512 0.000 0.000 0.000 20.000000 0 0.0001.0000E+20
I tried to replace the first record of each line with the first record of other line but was not successful. I would be thankful if somebody can help me doing is using sed.
best regards.
produces
Update: since the whitespace is significant, you can use string replacements. Here’s awk:
producing