Working in linux/shell env, how can I accomplish the following:
text file 1 contains:
1
2
3
4
5
text file 2 contains:
6
7
1
2
3
4
I need to extract the entries in file 2 which are not in file 1. So ‘6’ and ‘7’ in this example.
How do I do this from the command line?
many thanks!
Explanation of how the code works:
Explanation of details:
FNRis the current file’s record numberNRis the current overall record number from all input filesFNR==NRis true only when we are reading file1$0is the current line of texta[$0]is a hash with the key set to the current line of texta[$0]++tracks that we’ve seen the current line of text!($0 in a)is true only when we have not seen the line text