Ubuntu – Comparing two text files and save the missing

command linediff()text;

I have two text files:

first text file:

Hello
Hi
Hola
Bonjour

Second text file:

Hi 
Bonjour

How can I output the differences between them regardless the line number i.e. I want to save the output which is

Hello
Hola

Into a new text file

Best Answer

It's not clear what "the differences" means, but here is something that meets your given inputs and output:

$ cat >1
Hello
Hi
Hola
Bonjour

$ cat >2
Hi
Bonjour

$ diff  --old-line-format=''  <(sort 1)  <(sort 2)  >new

$ cat new
Hi
Bonjour