I was trying to merge files using either of these commands:
paste data_{1..2}.txt > 1_2.txt
paste <(awk '{print $1}' data_2.txt ) <(awk '{print $1}' data_2.txt) > 1_2.txt
But the columns in the output don't line up. I tried to clean tabs and spaces but I still get the same result. Here is my sample data below for data_1.txt:
TMAX
34.2481
19.1582
-0.903817
-0.408851
-0.849964
0.596377
0.922126
-5.13179
-17.4449
-15.1031
-12.5849
-12.2548
...and for data_2.txt:
TMAX
33.629
18.5924
-1.37411
-1.00714
-1.48201
0.0046866
0.295162
-5.69127
-18.0672
-15.7163
-13.1048
-12.8443
-11.9689
The combined output:
TMAX
TMAX
34.2481
33.629
19.1582
18.5924
-0.903817
-1.37411
-0.408851
-1.00714
-0.849964
-1.48201
0.596377
0.0046866
0.922126
0.295162
-5.13179
-5.69127
-17.4449
-18.0672
-15.1031
-15.7163
What is expected of course is for the columns to line up like so:
TMAX TMAX
34.2481 33.629
19.1582 18.5924
-0.903817 -1.37411
-0.408851 -1.00714
-0.849964 -1.48201
0.596377 0.0046866
0.922126 0.295162
-5.13179 -5.69127
-17.4449 -18.0672
-15.1031 -15.7163
-12.5849 -13.1048
-12.2548 -12.8443
-11.371 -11.9689
Why am I getting the distorted output with lines split and indentation?
cat -et data_1.txtshow any weird output?\r\ninstead of\n. Just remove\rand trypasteagain.