diff

diff -u file1.txt file2.txt > file2.patch  # "-u" is for a unified diff format
patch -l file2.txt file2.patch  # "-l" is to ignore whitespace differences

Diff can ignore whitespaces with “-w”.