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
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:
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
file1
also contain-13 -4 -1 38.5696 39.0027 1
? The string ` -13 -4 -1` is in bothfile1
andfile2
.