Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Aug 2008 08:46:47 -0400
From:      Steve Bertrand <steve@ibctech.ca>
To:        freebsd-questions@freebsd.org
Subject:   sed/awk, instead of Perl
Message-ID:  <48AD63B7.8090107@ibctech.ca>

next in thread | raw e-mail | index | archive | help
I'm frequently having to modify/convert email addresses from one 
format/domain to another.

Usually, I slap together a quick Perl script to do this for me. I don't 
do it frequently enough to keep track which one of my scripts does this 
for me, so I'm continuously re-inventing the wheel.

Some of the time, I use sed/awk to do this, but that usually requires a 
few passes over a few files.

To put it plainly, can anyone, if it's possible, provide a single line 
sed/awk pipeline that can:

- read email addresses from a file in the format:

user.name TAB domain.tld

- convert it to:

user_name@example.com

- write it back to either a new file, the original file, or to STDOUT

Regards,

Steve



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48AD63B7.8090107>