Skip to main content
formatting; tags
Source Link
chaos
  • 49.3k
  • 11
  • 127
  • 147

file 1

-13 -5 0 19.3769 46.9197 1

-13 -4 -2 347.911 57.7232 1

-13 -4 -1 38.5696 39.0027 1

-13 -4 0 2227.39 124.894 1

-13 -3 -3 113.001 40.2117 1

-13 -3 -2 850.847 78.2881 1

file 2

-13 -5 0 2.19085 50.4632 1

-13 -4 -2 283.628 56.7731 1

-13 -4 -1 41.179 48.6423 1

-13 -4 0 1753.54 125.88 1

-13 -3 -3 28.2363 40.6518 1

-13 -3 -2 562.736 66.0301 1

-13 -3 -1 750.747 77.2795 1

OUTPUT file 1

-13 -5 0 19.3769 46.9197 1

-13 -4 -2 347.911 57.7232 1

-13 -4 -1 38.5696 39.0027 1

-13 -3 -3 113.001 40.2117 1

-13 -3 -2 850.847 78.2881 1file1:

OUTPUT file 2

 -13  -5   0 19.3769 46.9197   1
 -13  -4  -2 347.911 57.7232   1
 -13  -4  -1 38.5696 39.0027   1
 -13  -4   0 2227.39 124.894   1
 -13  -3  -3 113.001 40.2117   1
 -13  -3  -2 850.847 78.2881   1

-13 -5 0 2.19085 50.4632 1file2:

-13 -4 -2 283.628 56.7731 1

 -13  -5   0 2.19085 50.4632   1
 -13  -4  -2 283.628 56.7731   1
 -13  -4  -1  41.179 48.6423   1
 -13  -4   0 1753.54  125.88   1
 -13  -3  -3 28.2363 40.6518   1
 -13  -3  -2 562.736 66.0301   1
 -13  -3  -1 750.747 77.2795   1

-13 -4 -1 41.179 48.6423 1 Output file1:

-13 -3 -3 28.2363 40.6518 1

 -13  -5   0 19.3769 46.9197   1
 -13  -4  -2 347.911 57.7232   1
 -13  -4  -1 38.5696 39.0027   1
 -13  -3  -3 113.001 40.2117   1
 -13  -3  -2 850.847 78.2881   1

-13 -3 -2 562.736 66.0301 1 Output file2

Any help will be appreciated, thanks!

 -13  -5   0 2.19085 50.4632   1
 -13  -4  -2 283.628 56.7731   1
 -13  -4  -1  41.179 48.6423   1
 -13  -3  -3 28.2363 40.6518   1
 -13  -3  -2 562.736 66.0301   1

file 1

-13 -5 0 19.3769 46.9197 1

-13 -4 -2 347.911 57.7232 1

-13 -4 -1 38.5696 39.0027 1

-13 -4 0 2227.39 124.894 1

-13 -3 -3 113.001 40.2117 1

-13 -3 -2 850.847 78.2881 1

file 2

-13 -5 0 2.19085 50.4632 1

-13 -4 -2 283.628 56.7731 1

-13 -4 -1 41.179 48.6423 1

-13 -4 0 1753.54 125.88 1

-13 -3 -3 28.2363 40.6518 1

-13 -3 -2 562.736 66.0301 1

-13 -3 -1 750.747 77.2795 1

OUTPUT file 1

-13 -5 0 19.3769 46.9197 1

-13 -4 -2 347.911 57.7232 1

-13 -4 -1 38.5696 39.0027 1

-13 -3 -3 113.001 40.2117 1

-13 -3 -2 850.847 78.2881 1

OUTPUT file 2

-13 -5 0 2.19085 50.4632 1

-13 -4 -2 283.628 56.7731 1

-13 -4 -1 41.179 48.6423 1

-13 -3 -3 28.2363 40.6518 1

-13 -3 -2 562.736 66.0301 1

Any help will be appreciated, thanks!

file1:

 -13  -5   0 19.3769 46.9197   1
 -13  -4  -2 347.911 57.7232   1
 -13  -4  -1 38.5696 39.0027   1
 -13  -4   0 2227.39 124.894   1
 -13  -3  -3 113.001 40.2117   1
 -13  -3  -2 850.847 78.2881   1

file2:

 -13  -5   0 2.19085 50.4632   1
 -13  -4  -2 283.628 56.7731   1
 -13  -4  -1  41.179 48.6423   1
 -13  -4   0 1753.54  125.88   1
 -13  -3  -3 28.2363 40.6518   1
 -13  -3  -2 562.736 66.0301   1
 -13  -3  -1 750.747 77.2795   1

Output file1:

 -13  -5   0 19.3769 46.9197   1
 -13  -4  -2 347.911 57.7232   1
 -13  -4  -1 38.5696 39.0027   1
 -13  -3  -3 113.001 40.2117   1
 -13  -3  -2 850.847 78.2881   1

Output file2

 -13  -5   0 2.19085 50.4632   1
 -13  -4  -2 283.628 56.7731   1
 -13  -4  -1  41.179 48.6423   1
 -13  -3  -3 28.2363 40.6518   1
 -13  -3  -2 562.736 66.0301   1
Source Link

Compare columns between different files

I have multiple files ( about 20 files with 30000 lines and 32 columns) and I need to keep only the lines that start with the same string. I found these cases that are quite similar to what I need but I don't know how to adapt them..

compare multiple files(more than two) with two different columns

how to compare values in two columns in two different files, echoing full lines where absolute value of difference is < a small maximum value?

In my case each file has a first column made of strings of 12 characters, I need to keep only the lines starting with strings that are present in ALL the files. (one file for every input file or also a single output file like the one in the above mentioned cases is fine). My files are like this:

file 1

-13 -5 0 19.3769 46.9197 1

-13 -4 -2 347.911 57.7232 1

-13 -4 -1 38.5696 39.0027 1

-13 -4 0 2227.39 124.894 1

-13 -3 -3 113.001 40.2117 1

-13 -3 -2 850.847 78.2881 1

file 2

-13 -5 0 2.19085 50.4632 1

-13 -4 -2 283.628 56.7731 1

-13 -4 -1 41.179 48.6423 1

-13 -4 0 1753.54 125.88 1

-13 -3 -3 28.2363 40.6518 1

-13 -3 -2 562.736 66.0301 1

-13 -3 -1 750.747 77.2795 1

OUTPUT file 1

-13 -5 0 19.3769 46.9197 1

-13 -4 -2 347.911 57.7232 1

-13 -4 -1 38.5696 39.0027 1

-13 -3 -3 113.001 40.2117 1

-13 -3 -2 850.847 78.2881 1

OUTPUT file 2

-13 -5 0 2.19085 50.4632 1

-13 -4 -2 283.628 56.7731 1

-13 -4 -1 41.179 48.6423 1

-13 -3 -3 28.2363 40.6518 1

-13 -3 -2 562.736 66.0301 1

Any help will be appreciated, thanks!