grep
é a ferramenta certa para o trabalho, embora não seja nem Bash nem da CoreUtils:
grep -Fxvf A B
Todas essas opções são compatíveis com POSIX. De man 1 grep
:
-f pattern_file
Read one or more patterns from the file named by the pathname pattern_file
. Patterns in pattern_file
shall be terminated by a . A null pattern can be specified by an empty line in pattern_file. Unless the -E
or -F
option is also specified, each pattern shall be treated as a BRE, as described in the Base Definitions volume of POSIX.1-2008, Section 9.3, Basic Regular Expressions.
-F
Match using fixed strings. Treat each pattern specified as a string instead of a regular expression. If an input line contains any of the patterns as a contiguous sequence of bytes, the line shall be matched. A null string shall match every line.
-v
Select lines not matching any of the specified patterns. If the -v
option is not specified, selected lines shall be those that match any of the specified patterns.
-x
Consider only input lines that use all characters in the line excluding the terminating to match an entire fixed string or regular expression to be matching lines.