Replacing everything before the @ symbol
Hello all,
I have a list of email address's that I need to sift through to identify only the domain name. xyz@yo.com abs@yo.com clahclah@test.com I want to remove everything before the @ symbol and only print the domain name. Can anyone assist with this? |
cut -d@ -f2 emails.txt
|
try posting what you have tried next time.
Code:
awk -F"@" '{print $2}' file |
Code:
sed 's/^.*@//' filename > newfilename |
Q: Which is better--SED or AWK?
A: cut (at least it's the most readable.) ;) |
Quote:
|
"print $2" just sounds like you are a counterfeiter, whereas -f2 OBVIOUSLY means the second field.....
Sorry, I know AWK is better...........;) Actually, in the example, "cut" is confusing---it does not remove the specified data. Perhaps the command should be renamed "keep" |
Quote:
Quote:
Quote:
|
Thanks to you all for your help!
|
All times are GMT -5. The time now is 07:49 PM. |