Boolean Difference between text files in Linux?

Are there any command line linux utilities that will give me a logical distinction between two text files?

Value:

File-A:

Apple  
Pear  
Orange   
Banana

File-B:

Pear  
Orange

Launch

% program File-A File-B -o output

conclusion:

Apple  
Banana 

Edit:

Amazing thanks guys!

+3
source share
3 answers

Like this:

comm -2 -3 File-A File-B > output

This assumes the files are sorted. Check man commfor more information.

+3
source

A team is what you want here.

+1
source

:

comm -3 file1.txt file2.txt | sed -r 's/^\t//'

2, 1.

0

Source: https://habr.com/ru/post/1730763/


All Articles