How to grep against a list of domains without using a bash script
I have been given a list of disposable emails and other emails that my company does not want in our mailing list and asked to remove them. I know grep -v or awk !/xxx/' but this is against a list of 1000 email domains they do not want. I could use a bash script but they are only being sorted one at a time which still leave manual sorting. Any ideas are welcone please
awk sed grep email domain
New contributor
add a comment |
I have been given a list of disposable emails and other emails that my company does not want in our mailing list and asked to remove them. I know grep -v or awk !/xxx/' but this is against a list of 1000 email domains they do not want. I could use a bash script but they are only being sorted one at a time which still leave manual sorting. Any ideas are welcone please
awk sed grep email domain
New contributor
1
You haven't really explained what you are trying to do. What do you want to grep?
– Jesse_b
6 hours ago
2
So, you have a mailing list file "A". You also have a thousand-plus lines list of domains and email addresses "B" to remove from the mailing list file. You want a fairly rapid automated method to remove B from A. Is that correct? Please click edit and clarify your question.
– K7AAY
6 hours ago
add a comment |
I have been given a list of disposable emails and other emails that my company does not want in our mailing list and asked to remove them. I know grep -v or awk !/xxx/' but this is against a list of 1000 email domains they do not want. I could use a bash script but they are only being sorted one at a time which still leave manual sorting. Any ideas are welcone please
awk sed grep email domain
New contributor
I have been given a list of disposable emails and other emails that my company does not want in our mailing list and asked to remove them. I know grep -v or awk !/xxx/' but this is against a list of 1000 email domains they do not want. I could use a bash script but they are only being sorted one at a time which still leave manual sorting. Any ideas are welcone please
awk sed grep email domain
awk sed grep email domain
New contributor
New contributor
New contributor
asked 6 hours ago
LukeLuke
61
61
New contributor
New contributor
1
You haven't really explained what you are trying to do. What do you want to grep?
– Jesse_b
6 hours ago
2
So, you have a mailing list file "A". You also have a thousand-plus lines list of domains and email addresses "B" to remove from the mailing list file. You want a fairly rapid automated method to remove B from A. Is that correct? Please click edit and clarify your question.
– K7AAY
6 hours ago
add a comment |
1
You haven't really explained what you are trying to do. What do you want to grep?
– Jesse_b
6 hours ago
2
So, you have a mailing list file "A". You also have a thousand-plus lines list of domains and email addresses "B" to remove from the mailing list file. You want a fairly rapid automated method to remove B from A. Is that correct? Please click edit and clarify your question.
– K7AAY
6 hours ago
1
1
You haven't really explained what you are trying to do. What do you want to grep?
– Jesse_b
6 hours ago
You haven't really explained what you are trying to do. What do you want to grep?
– Jesse_b
6 hours ago
2
2
So, you have a mailing list file "A". You also have a thousand-plus lines list of domains and email addresses "B" to remove from the mailing list file. You want a fairly rapid automated method to remove B from A. Is that correct? Please click edit and clarify your question.
– K7AAY
6 hours ago
So, you have a mailing list file "A". You also have a thousand-plus lines list of domains and email addresses "B" to remove from the mailing list file. You want a fairly rapid automated method to remove B from A. Is that correct? Please click edit and clarify your question.
– K7AAY
6 hours ago
add a comment |
1 Answer
1
active
oldest
votes
If I understand you correctly you have a file that is a mailing list.
$ cat mail_list
email1@domain1.com
email2@domain2.com
email3@domain3.com
email4@domain4.com
email5@domain5.com
You have a file that is a black list.
$ cat blacklist
email2@domain2.com
email4@domain4.com
You want to make a new mailing list file with the email addresses in the black list removed?
Using the blacklist file with grep
:
-f file, --file=file
Read one or more newline separated patterns from file. Empty pattern lines match every input line. Newlines are not considered part of a pattern. If
file is empty, nothing is matched.
$ grep -vxFf blacklist mail_list
email1@domain1.com
email3@domain3.com
email5@domain5.com
To make a new mailing list you would redirect this into the file like:
$ grep -vxFf blacklist mail_list > new_mail_list
Which you could then use to overwrite the old mail list
$ mv new_mail_list mail_list
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Luke is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f507807%2fhow-to-grep-against-a-list-of-domains-without-using-a-bash-script%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If I understand you correctly you have a file that is a mailing list.
$ cat mail_list
email1@domain1.com
email2@domain2.com
email3@domain3.com
email4@domain4.com
email5@domain5.com
You have a file that is a black list.
$ cat blacklist
email2@domain2.com
email4@domain4.com
You want to make a new mailing list file with the email addresses in the black list removed?
Using the blacklist file with grep
:
-f file, --file=file
Read one or more newline separated patterns from file. Empty pattern lines match every input line. Newlines are not considered part of a pattern. If
file is empty, nothing is matched.
$ grep -vxFf blacklist mail_list
email1@domain1.com
email3@domain3.com
email5@domain5.com
To make a new mailing list you would redirect this into the file like:
$ grep -vxFf blacklist mail_list > new_mail_list
Which you could then use to overwrite the old mail list
$ mv new_mail_list mail_list
add a comment |
If I understand you correctly you have a file that is a mailing list.
$ cat mail_list
email1@domain1.com
email2@domain2.com
email3@domain3.com
email4@domain4.com
email5@domain5.com
You have a file that is a black list.
$ cat blacklist
email2@domain2.com
email4@domain4.com
You want to make a new mailing list file with the email addresses in the black list removed?
Using the blacklist file with grep
:
-f file, --file=file
Read one or more newline separated patterns from file. Empty pattern lines match every input line. Newlines are not considered part of a pattern. If
file is empty, nothing is matched.
$ grep -vxFf blacklist mail_list
email1@domain1.com
email3@domain3.com
email5@domain5.com
To make a new mailing list you would redirect this into the file like:
$ grep -vxFf blacklist mail_list > new_mail_list
Which you could then use to overwrite the old mail list
$ mv new_mail_list mail_list
add a comment |
If I understand you correctly you have a file that is a mailing list.
$ cat mail_list
email1@domain1.com
email2@domain2.com
email3@domain3.com
email4@domain4.com
email5@domain5.com
You have a file that is a black list.
$ cat blacklist
email2@domain2.com
email4@domain4.com
You want to make a new mailing list file with the email addresses in the black list removed?
Using the blacklist file with grep
:
-f file, --file=file
Read one or more newline separated patterns from file. Empty pattern lines match every input line. Newlines are not considered part of a pattern. If
file is empty, nothing is matched.
$ grep -vxFf blacklist mail_list
email1@domain1.com
email3@domain3.com
email5@domain5.com
To make a new mailing list you would redirect this into the file like:
$ grep -vxFf blacklist mail_list > new_mail_list
Which you could then use to overwrite the old mail list
$ mv new_mail_list mail_list
If I understand you correctly you have a file that is a mailing list.
$ cat mail_list
email1@domain1.com
email2@domain2.com
email3@domain3.com
email4@domain4.com
email5@domain5.com
You have a file that is a black list.
$ cat blacklist
email2@domain2.com
email4@domain4.com
You want to make a new mailing list file with the email addresses in the black list removed?
Using the blacklist file with grep
:
-f file, --file=file
Read one or more newline separated patterns from file. Empty pattern lines match every input line. Newlines are not considered part of a pattern. If
file is empty, nothing is matched.
$ grep -vxFf blacklist mail_list
email1@domain1.com
email3@domain3.com
email5@domain5.com
To make a new mailing list you would redirect this into the file like:
$ grep -vxFf blacklist mail_list > new_mail_list
Which you could then use to overwrite the old mail list
$ mv new_mail_list mail_list
edited 6 hours ago
answered 6 hours ago
Jesse_bJesse_b
13.8k23471
13.8k23471
add a comment |
add a comment |
Luke is a new contributor. Be nice, and check out our Code of Conduct.
Luke is a new contributor. Be nice, and check out our Code of Conduct.
Luke is a new contributor. Be nice, and check out our Code of Conduct.
Luke is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f507807%2fhow-to-grep-against-a-list-of-domains-without-using-a-bash-script%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You haven't really explained what you are trying to do. What do you want to grep?
– Jesse_b
6 hours ago
2
So, you have a mailing list file "A". You also have a thousand-plus lines list of domains and email addresses "B" to remove from the mailing list file. You want a fairly rapid automated method to remove B from A. Is that correct? Please click edit and clarify your question.
– K7AAY
6 hours ago