Timeline for How do I delete lines of 1st file if it matches the string present in the 2nd file in linux?
Current License: CC BY-SA 4.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 28, 2019 at 15:27 | comment | added | Joce | @JoneyWalker Indeed that's shorter! | |
Jan 28, 2019 at 12:04 | comment | added | Joney Walker |
After some more research, I found - Rather using a long regex, this works with this simple line too: grep -vf <(sed 's/$/$/' Banned.txt) Emails.txt
|
|
Jan 24, 2019 at 14:15 | history | edited | Joce | CC BY-SA 4.0 |
added 11 characters in body
|
Jan 23, 2019 at 13:25 | vote | accept | Joney Walker | ||
Jan 23, 2019 at 12:58 | comment | added | Joney Walker | grep -vf worked like a charm... Thanks. | |
Jan 23, 2019 at 12:52 | history | edited | Joce | CC BY-SA 4.0 |
added 225 characters in body
|
Jan 23, 2019 at 12:48 | comment | added | Joce |
That's the purpose of the -v . Have you tried it?
|
|
Jan 23, 2019 at 12:46 | comment | added | Joney Walker | This is not correct. The Output of the file should show ONLY the line whose sting doesn't match with Banned.txt file. Which means, all the domains / strings listed in the Banned.txt file should get deleted in the first file Emails.txt | |
Jan 23, 2019 at 12:34 | history | answered | Joce | CC BY-SA 4.0 |