I've compared two files that are of different lengths, for which I first found unique IDs that ARE present in file 1 but not in file 2.
However, now I want to find common unique values between the files, I've seen multiple times the use of the comm command, however, these files are not of the same length.
Example
file 1:
2
4
6
8
10
file 2:
9
8
7
6
5
4
3
2
1
Desired Output:
2
4
6
8
For Finding Unique Differences I used the following command:
awk 'FNR==NR {a[$0]++; next} !($0 in a)' file1.sorted file2.sorted > diff_values.txt
For Finding Common Values I have tried using the following command but am not entirely sure if this is the correct approach or if there exist any alternatives:
comm -12 file1.sorted file2.sorted > comm_values.txt