Steve Bertrand wrote:
 > 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:
 > 
 > [EMAIL PROTECTED]

With awk(1):

    awk '{sub(/\./, "_", $1); print $1 "@example.com"}'

With sed(1) (you have to replace "^T" with a real tab!):

    sed 's/^\(.*\)\.\(.*\)^T.*/[EMAIL PROTECTED]/'

With tr(1) + sed(1):

    tr '.\t' '_@' | sed 's/@.*/@example.com/'

Personally I like the last solution best, because it's
short and easy to understand.

BTW, all of the above command read from stdin and write
to stdout, so you can use shell redirection to read from
a file and/or write to a file.  There is no need to use
cat(1).

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

With Perl you can manipulate text, interact with programs, talk over
networks, drive Web pages, perform arbitrary precision arithmetic,
and write programs that look like Snoopy swearing.
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to