Searching .txt file for (specific) strings and printing them to new file
Hey, I know the title was too long but basically, what I'm trying to do is take a specific string from a text file and print the strings to a seperate file and on a new line. May seem confusing but here's an example.
Name: Bob, PhoneNumber: *****, MobileNumber: *****, Email: ***@**.com,
And I have a file with this type of formatting; if I was using the above example, I would like to take only the Emails from the file and print them to a completely seperate file by > seperate-file.txt but the problem is, I don't know how to go about that.
I tried using grep to search for a string of "***@***.com" but that would only print the entire line including Name, PhoneNumber, etcetera and after reading the man pages, found out that it's for whole lines.
I was wondering if anybody knew of a command that I could do this with? It's beginning to give me a bit of a headache.
Thanks for any help in advanced.