0

Consider I have 2 text files with each row in both files containing certain fields delimited by '|'. If I have sorted the files using the 3rd column, does comm -23 file1.txt file2.txt > difference.txt give me the rows which are present in file1.txt and NOT in file2.txt?

Thanks in advance.

Charles Duffy
  • 280,126
  • 43
  • 390
  • 441
Deepak K M
  • 521
  • 1
  • 5
  • 13
  • Could you try to come up with a clearer title than "how does comm work", and an explanation of your question that covers the corner cases? I'm not clear on whether you want to filter only on the third column, and if so, what you want to do with lines with identical third columns but differ otherwise. – Charles Duffy May 21 '15 at 19:56

1 Answers1

0

No, you can only use comm for files sorted from the start of the line.
You can make a script that sorts the files on column 1, use comm, and sort on column 3 afterwards.

Walter A
  • 19,067
  • 2
  • 23
  • 43