which lines are identical in the two files
Hi everyone!
I am trying to write a command to find out which lines are identical in the two files. I come up with grep -f file1 file2 > newfile The problem is when I open newfile, it is empty. There is nothing there. Any suggestions, please? Thank you very much! |
Your command works for me. Maybe file1 and file2 have no lines in common.
|
Ummm.... interesting. I typed using vi an exact line in both files, but that line is not shown in the newfile.
|
Does file1 have any special characters in it? (e.g. ".", "*", "\", "[", "]", etc)
You should use -F (fixed strings, rather then regexps) Code:
grep -Ff file1 file2 > newfile |
You could also try looking at the comm command.
|
Thank you everyone!!!!!!!!!!!!!!!!!!!
|
All times are GMT -5. The time now is 09:50 PM. |