1

Can one suggest a grep command for finding a string in a list of files by providing a part of the string?

I have a list of files in a directory which contains email addresses. I want to extract all email addresses ending with a particular domain name. for example, i want to get a list of all emails ending with "@google.com" in a file.

Directory contains N number of files. The data in each file is a single line seperated with a comma. I have tried so many options with grep command and none worked.

Thanks,

0

1 Answer 1

6

You can try something like:

grep -E -o "\b[a-zA-Z0-9.-_]+@google\.com\b" *.files 

Basically include the list of characters in the [a-zA-Z0-9.-_] character class which constitutes acceptable email addresses.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.