Hi All, thanks for all the suggestions. With this it works: cat mail.txt | egrep "[EMAIL PROTECTED]" | egrep "\.[a-zA-Z]{2,4}$"
It is probably possible to avoid the last egrep but I have not find out how. Regards, Stefan >> I got in the output (Which I not want): >> [EMAIL PROTECTED] -> I believed with [a-zA-Z]{2,4} I can limit it after the >> "." Or? >> [EMAIL PROTECTED] -> It should be as well not possible with [a-zA-Z]{2,4} >> >> How can I exclude this? > You did not say that after the 2-4 characters the line should end... > End the pattern with $ >> As weel I got as output this which I do not want: >> [EMAIL PROTECTED] >> >> $ is normall end of a line. But it should not be in a mail address. >> >> [a-zA-Z0-9.-_]+@ >> I use the "+" here with the meaning the [a-zA-Z0-9.-_] has to be available >> min. one of them. Nothing for a @ makes really no sense. > You did not say it should be at the beginning.. everything can be in > front of the matching token. Start the pattern with ^ > Also you are not escaping the . - meaning it can match to anything. > try it with this: > egrep "[EMAIL PROTECTED],4}$" > good source to read more about it is re_format(7) > Regards, > Julian