Examples of Linux Text Comparison Commands

Examples of Linux Text Comparison Commands

1. Use diff file1.txt file2.txtHow to distinguish: < indicates lines only in file1.txt, > indicates lines only in file2.txt2. Use grep grep -Fxv -f file1.txt file2.txt Only exists in file2.txt grep -Fxv -f file2.txt file1.txt Only exists in file1.txt Parameter explanation -F: Treat the pattern as a fixed string (not a regex). -x: Match the … Read more