Walt Pawley wrote:
 > Walt Pawley wrote:
 > > Walt Pawley wrote:
 > > > Steve Bertrand wrote:
 > > > > - read email addresses from a file in the format:
 > > > > 
 > > > > user.name TAB domain.tld
 > > > > 
 > > > > - convert it to:
 > > > > 
 > > > > [EMAIL PROTECTED]
 > > > > 
 > > > > - write it back to either a new file, the original file, or to STDOUT
 > > > 
 > > > I'm curious why Perl isn't a decent choice. I think I'd do something like
 > > > 
 > > > perl -pe 's/(.*?)\.(.*)\t.*/[EMAIL PROTECTED]/' input_file > output_file
 > > 
 > > Which is also wrong. It gets a bit closer to Steve's desires I
 > > suspect if one adds the appropriate backslash ...
 > > 
 > > perl -pe 's/(.*?)\.(.*)\t.*/[EMAIL PROTECTED]/' input_file > output_file
 > > 
 > > Sorry...
 > 
 > I guess getting old, nearly blind and mind numbing close to
 > brain dead is better than the alternative. Try this (sooner or
 > later I've got to get it right)...
 > 
 > perl -pe 's/(.*?)\.(.*)\t.*/[EMAIL PROTECTED]/' input_file > output_file
 > 
 > Sorrier.

I think your attempts show very well why Steve wanted to
avoid perl.  :-)

But seriously, a few other reasons might include:

 - tr, sed, awk etc. are part of the FreeBSD base system,
   while perl is not.

 - The perl command you wrote above is pretty much a sed
   command anyway (except you incorrectly used non-portable
   regular expression syntax).  Why use perl to execute a
   sed command?

 - It is generally advisable to use the smallest, most
   light-weight tool that gets thew job done.  In this case
   that's clearly not perl:

   Size of sed:  27 KB.
   Size of perl + libperl:  1126 KB

   Thats more than 40 times bigger.

Of course, YMMV.

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

"It combines all the worst aspects of C and Lisp:  a billion different
sublanguages in one monolithic executable.  It combines the power of C
with the readability of PostScript."
        -- Jamie Zawinski, when asked: "What's wrong with perl?"
_______________________________________________
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