Remove all the matched lines from second file
I have 2 hosts file. I need to remove from first file all the lines which matches second file.
Example File1 127.0.0.1 swaypix.com 127.0.0.1 www.swaypix.com 127.0.0.1 redtram.com 127.0.0.1 goods.redtram.com File2 swaypix.com www.swaypix.com buyshoesfitflop.webs.com Output: 127.0.0.1 redtram.com 127.0.0.1 goods.redtram.com What's the best way to do that? Thank you in advance |
Problem Solved:
Answer to my own question I had to delete all "127.0.0.1" from File1 join -v 1 <(sort fileA) <(sort fileB) |
I am curious how your solution has provided you with your output?
Surely if you have gone to the trouble of editing File1, running your commands and then opening the outputed file to once again re-add the ip addresses, it would have been quicker to have just manually created the file in the first place? Maybe you could have tried something like: Code:
grep -vf File2 File1 |
Quote:
|
All times are GMT -5. The time now is 03:21 AM. |