I have two files:
- one generated using
findcommand in a folder to list files, sorting them numerically and writing to a file,
- and the other generated by a python script, which is not sorted, so I explicitly sort it numerically.
The problem is that my
sort output only has two columns and is as follows:
500016 500016 500174 500174 500277 500277
As you can see, even the common entries are shown separately in two columns and the third column is missing altogether, implying that there is nothing common between the two files, whereas these first three entries are indeed same.
sort otherwise works as expected with some test files that I make.
I know that
comm needs the two files to be lexically sorted, and here is a list of options I tried and failed:
comm <(sort file1.txt) <(sort file2.txt)
from https://unix.stackexchange.com/a/377689/187419 failed. I also tried giving the
-d option to
sort explicitly, and also tried explicitly rewriting the files with dictionary sort -- both didn't work
comm --check-order <(sort file1.txt) <(sort file2.txt)
from https://unix.stackexchange.com/a/186101/187419 did not return any order error; it ran as usual giving two output columns.
This solution for a problem very close to mine is also not working.
Thinking that it might be because of some additional characters in the file, I also the solution mentioned here to do
:set list in vim.
Just to test if
sort is causing issues, I deliberately sorted the test files I made (with which
comm worked earlier) numerically and
comm still worked.
I tried the solutions I could find, to no avail. Any other suggestions?