Need to strip few letters

Hey guys..

          Can experts help me in achieving my purpose..

I have a file which contains email address of some 100 to 1000 domains, I need only the domain names..

Eg: abc@yahoo.com
hd@gamil.com
ed@hotmail.com

The output should contain only

Yahoo.com
gmail.com
hotmail.com

Thanks in Advance...

if that sample is all you have,

awk -F"@" '{.....}' file

or

cut -d "@" -f ....  file

or in shell

while IFS="@" read -r a b
do
 .....
done < "file"

cat temp.txt | perl -pe 's/^.*@(.*)$/$1/'

This will handle the sample lines you provided.

And a sed one

$ sed 's/\(.*\)@\(.*\)/\2/' email.txt

//Jadu

forget the cat.

perl -pe 's/^.*@(.*)$/$1/' temp.txt

I always use the cat, although it's unnecessary. It adds uniformity. Some people feel the need to use as few characters as possible, or to spare the processor the extra load. But others (me included) see the cat as a convenient way to add clarity. To each his own.

I also get yelled at by my friends for usually using "sort | uniq" instead of "sort -u." Because I so often use "sort | uniq -cd" or pipe to "wc -l," it's a lot easier to always type it the same way. Also it adds clarity. The power in all the tiny tools on a *nix box is that they can be strung together to do amazingly complex tasks. It is not (and should not be) the goal of any one program to overreach and try to do too much.

However, you're correct about the cat and my friends are correct about the sort -u. I just prefer to do it my way. Stubborn, I guess. At least I finally started using CTRL+R instead of piping the history command through a grep. Usually...

ShawnMilo