jimmyf
1
have a file1
aaa-bbb-ccc-abcd
aaa-bbb-ccc-bacd
aaa-bbb-ccc-aaad
aaa-bbb-ccc-a
have another file2
aaa-bbb-ccc-a file
using the fgrep command, trying to have only the literal string returned.
fgrep -f file2 file1
is returning
aaa-bbb-ccc-abcd
aaa-bbb-ccc-aaad
aaa-bbb-ccc-a
Only looking for
aaa-bbb-ccc-a
any ideas?
The literal string aaa-bbb-ccc-a file
that is in file2
does not appear anywhere in file1
. Why do you think there should be any output???
If file2
contained:
aaa-bbb-ccc-a
instead of:
aaa-bbb-ccc-a file
then the command:
fgrep -x -f file2 file1
or:
grep -Fx -f file2 file1
should do what you want.
1 Like