Issue
I'm running a bash commando to filter a file using grep
, awk
and xargs
, and I'm happy with the output I'm getting, however I would also like to exclude some lines based on content of an existing file.
E.g
My output
IP1 HostX1
IP2 HostY2
IP3 HostY3
IP4 HostY4
IP5 HostY5
IP6 HostY6
IP7 HostX7
I want to be able to include grep -v
based on entire content of a file, e.g
diff ... | awk ... | xargs ... | grep -v FILE
The FILE
looks like:
IP2 HostY2
IP3 HostY3
IP4 HostY4
IP5 HostY5
IP6 HostY6
Desired output
IP1 HostX1
IP7 HostX7
Solution
I solved it adding following: commands ... | grep -v -f FILE
Answered By - N. J Answer Checked By - Robin (WPSolving Admin)