Perl Email Extraction

Nice one from a colleague:

perl -wne 'while(/[\w\.\-]+@[\w\.\-]+\w+/g){print "$&\n"}'

I should probably get set up with a snippet library for this kind of thing.

One thought on “Perl Email Extraction

  1. That’s a clever one.

    The Perl one-liner I use the most is:

    perl -e ‘s/oldtext/newtext/gi’ -i.bak -p /folder/of/files/to/change

    just multi-file search and replace. Really the only bit of Perl I use regularly.

Leave a Reply

Your email address will not be published. Required fields are marked *