18.2 Converting sed Programs to PerlWell, this may begin to sound like a repeat, but guess what? Perl is a semantic superset of sed as well as awk . And with the distribution comes a sed -to-Perl translator called s2p . As with a2p , s2p takes a sed script on standard input and writes a Perl program on standard output. Unlike a2p , the converted program rarely misbehaves, so you can pretty much count on it working, barring any bugs in s2p or Perl. Converted sed programs may work faster or slower than the original, but are generally much faster (thanks to the highly optimized regular expression routines of Perl).
The converted
sed
script can operate either with or without a
As an example of how versatile and powerful Perl is, the s2p translator is written in Perl. If you want to see how Larry codes in Perl (even though it's very ancient code relatively unchanged since Perl Version 2), take a look at the translator. Be sure you are sitting down. |
|