Skip to main content
maybe at least don't publish people's real email addresses
Source Link
grawity_u1686
  • 465.6k
  • 66
  • 977
  • 1.1k

Consider I have two text files.

First File name - "Emails.txt" with the following data:

00alenoush_p@hotmail00iiiiiiii_l@hotmail.com
00alitayfu@hotmail00rrrrrrrr@hotmail.com
00alqur@gmail00zzzzz@gmail.com
00amoinu@gotmail00eeeeee@gotmail.com
00amoinu@uor00gggggg@uor.edu
00anderson@yahoo00uuuuuuuu@yahoo.com
00c21_pk@cmail00e21_ss@cmail.com
00chemitex@cmail00gggggggg@cmail.com
00cindysun48@hotmail00zzzzzzzz48@hotmail.com
00consult_2020@gotmail00aaaaaaa_2020@gotmail.com
brandcat@gmailjjjjjjjj@gmail.com

Second text file - "Banned.txt" with the following strings:

@gotmail.com
@cmail.com
@uor.edu

How to delete all the lines in the 1st text file "Emails.txt" if it matches the stings of any line present in the second text file "Banned.txt"?

The desired output of the new file should be:

00alenoush_p@hotmail00iiiiiiii_l@hotmail.com
00alitayfu@hotmail00rrrrrrrr@hotmail.com
00alqur@gmail00zzzzz@gmail.com
00anderson@yahoo00uuuuuuuu@yahoo.com
00cindysun48@hotmail00zzzzzzzz48@hotmail.com
brandcat@gmailjjjjjjjj@gmail.com

Can this be done using SED or awk in Linux? Can you please suggest how to do this?

Consider I have two text files.

First File name - "Emails.txt" with the following data:

00alenoush_p@hotmail.com
00alitayfu@hotmail.com
00alqur@gmail.com
00amoinu@gotmail.com
00amoinu@uor.edu
00anderson@yahoo.com
00c21_pk@cmail.com
00chemitex@cmail.com
00cindysun48@hotmail.com
00consult_2020@gotmail.com
brandcat@gmail.com

Second text file - "Banned.txt" with the following strings:

@gotmail.com
@cmail.com
@uor.edu

How to delete all the lines in the 1st text file "Emails.txt" if it matches the stings of any line present in the second text file "Banned.txt"?

The desired output of the new file should be:

00alenoush_p@hotmail.com
00alitayfu@hotmail.com
00alqur@gmail.com
00anderson@yahoo.com
00cindysun48@hotmail.com
brandcat@gmail.com

Can this be done using SED or awk in Linux? Can you please suggest how to do this?

Consider I have two text files.

First File name - "Emails.txt" with the following data:

00iiiiiiii_l@hotmail.com
00rrrrrrrr@hotmail.com
00zzzzz@gmail.com
00eeeeee@gotmail.com
00gggggg@uor.edu
00uuuuuuuu@yahoo.com
00e21_ss@cmail.com
00gggggggg@cmail.com
00zzzzzzzz48@hotmail.com
00aaaaaaa_2020@gotmail.com
jjjjjjjj@gmail.com

Second text file - "Banned.txt" with the following strings:

@gotmail.com
@cmail.com
@uor.edu

How to delete all the lines in the 1st text file "Emails.txt" if it matches the stings of any line present in the second text file "Banned.txt"?

The desired output of the new file should be:

00iiiiiiii_l@hotmail.com
00rrrrrrrr@hotmail.com
00zzzzz@gmail.com
00uuuuuuuu@yahoo.com
00zzzzzzzz48@hotmail.com
jjjjjjjj@gmail.com

Can this be done using SED or awk in Linux? Can you please suggest how to do this?

added 212 characters in body
Source Link

Consider I have two text files.

First File name - "Emails.txt" with the following data:

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

Second text file - "Banned.txt" with the following strings:

@gotmail.com
@cmail.com
@uor.edu

How to delete all the lines in the 1st text file "Emails.txt" if it matches the stings of any line present in the second text file "Banned.txt"?

The desired output of the new file should be:

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

Can this be done using SED or awk in Linux? Can you please suggest how to do this?

Consider I have two text files.

First File name - "Emails.txt" with the following data:

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

Second text file - "Banned.txt" with the following strings:

@gotmail.com
@cmail.com
@uor.edu

How to delete all the lines in the 1st text file "Emails.txt" if it matches the stings of any line present in the second text file "Banned.txt"?

Can this be done using SED in Linux? Can you please suggest how to do this?

Consider I have two text files.

First File name - "Emails.txt" with the following data:

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

Second text file - "Banned.txt" with the following strings:

@gotmail.com
@cmail.com
@uor.edu

How to delete all the lines in the 1st text file "Emails.txt" if it matches the stings of any line present in the second text file "Banned.txt"?

The desired output of the new file should be:

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

Can this be done using SED or awk in Linux? Can you please suggest how to do this?

Source Link

How do I delete lines of 1st file if it matches the string present in the 2nd file in linux?

Consider I have two text files.

First File name - "Emails.txt" with the following data:

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

Second text file - "Banned.txt" with the following strings:

@gotmail.com
@cmail.com
@uor.edu

How to delete all the lines in the 1st text file "Emails.txt" if it matches the stings of any line present in the second text file "Banned.txt"?

Can this be done using SED in Linux? Can you please suggest how to do this?