0

I have a small question about the diff command. I am comparing two ascii files to check if there's a difference between them and print out the output to another ascii. However my problem is that the order of the contents of the files shouldn't matter, for example let's say we have:

file1.txt with

1  
2  
3  
4   
5  
6   
7

file2.txt with

1  
3      
2   
4

so that when i do a "diff" on them the output should just be:

5  
6  
7  

i.e the order of the two files shouldn't matter, it should just print out the whatever it is that is different between the two files.

0

2 Answers 2

1

How about:

comm -3 <(sort file1.txt) <(sort file2.txt)
Sign up to request clarification or add additional context in comments.

Comments

1

First you have to sort both the files and then input the files into diff command or comm command. There are many options for doing so.

Instead of providing a command that would do your job. I can provide you a link that can make you understand how it works.

Here it is Click here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.