I have two files:
file 1
dsf sdfsd dsfsdf
file 2
ljljlj lkklk dsf sdfsd dsfsdf
I want to display what is in file 2 but not in file 1, so file 3 should look like
ljljlj lkklk
If you all you want to know is whether two files are the same, use the -s (report identical files) option. You can use the -q (brief) option to get an equally terse statement about two files being different.
From the Micro Focus Data File Tools window, click Tools > Compare Files. The File Compare dialog box appears. Select the two data files to compare: In the File 1 section, click and select the required file.
grep -Fxvf file1 file2
What the flags mean:
-F, --fixed-strings Interpret PATTERN as a list of fixed strings, separated by newlines, any of which is to be matched. -x, --line-regexp Select only those matches that exactly match the whole line. -v, --invert-match Invert the sense of matching, to select non-matching lines. -f FILE, --file=FILE Obtain patterns from FILE, one per line. The empty file contains zero patterns, and therefore matches nothing.
You can try
grep -f file1 file2
or
grep -v -F -x -f file1 file2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With