I have two output files:
FILE-A:
TOM
JACK
AILEY
BORG
ROSE
ELI
FILE-B Content:
TOM
ELI
I want to remove anything listed in FILE-B from File-A.
FILE-C (Result file):
JACK
AILEY
BORG
ROSE
I assume I need a while r for i statement. Can someone help me with this?
I need to cat and read FILE-A and for every line in FILE-B I need to remove that from FILE-A.
What command should I use?
You don't need either awk, sed, or a loop. You just need grep:
fgrep -vxf FILE-B FILE-A
Please note the use of -x to match entries exactly.
Output:
JACK
AILEY
BORG
ROSE
You can use grep -v -f:
grep -xFvf FILE-B FILE-A
ACK
AILEY
BORG
ROSE
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