I have 2 different files-
File 1
2
4
6
8
10
12
File 2
2
3
5
6
10
12
I want to compare 2 files and get the output data which is in File 1 but not in File 2-
Output
4
8
I am using below command but not getting desired output-
comm -23 file1 file2

commexpects a lexicographic sort which is different from the numeric order of your inputs. Lexicographically,1,10, and12all need to sort before2, so you need to resort your file1 and file2 to use comm.comm. It's always important to share these in your question.