Extract Email Address

The file abc.af looks like this:

R1211566974^M
F<fettle@333empire.com>^M
T<gwensadler@vp.dk>^M

The following extracts the two email addresses:

cat abc.af |perl -wne'while(/[\w\.\-]+@[\w\.\-]+\w+/g){print "$&\n"}'
fettle@333empire.com
gwensadler@vp.dk

Making a list one line

If you have a list in a textfile:

abd
def
ghi

You want to make into:

abc def ghi

Do this:

cat /tmp/textfile |tr "\n" " " > /tmp/textfile.withoutnewlines.txt

This command substitute newlines (ā€œ\nā€) with spaces (ā€ ā€) and send it to the file textfile.withoutnewlines.txt

 
indexes/regex-stuff-mail.txt · Last modified: 2008/08/07 12:35 by domingo
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki