for perl wizards.

Warren Block wblock at
Fri Oct 9 19:19:39 UTC 2009

On Fri, 9 Oct 2009, Oliver Fromme wrote:
> Warren Block wrote:
> >
> > Certainly \x will not help in sed; sed doesn't have it.
> Right, that's an annoying flaw in sed (it doesn't even
> support the \0 syntax for octal values, which is more
> standard than \x).

>From my perspective, sed is a tiny, gooey center of usefulness nearly 
completely obscured by annoying flaws.  That's not fair to sed, since 
most of its flaws can be more fairly described as legacy behavior.

> Maybe the OP should configure his software to not save the
> file with UTF-8 encoding in the first place.  I'm not an
> OOo user, so I can't tell how to do that.  But obviously
> the OP doesn't want the file to be stored as UTF-8.

Sure.  That removes the need for any of these tools.

> > It's possible "Mastering Regular Expressions" has influenced my thinking
> > on this.
> This isn't about regular expressions at all.  This is
> about replacing fixed strings.

The OP was using a regex.  But my question was "why sed instead of 
Perl?"  tr(1) was also suggested, and is probably better than sed in 
this case.  Of course, tr is another tool that Perl can replace with 
added functionality.  Likewise Ruby, which has about the same 
command-line options as Perl but is less likely to be installed on a 
typical FreeBSD system.

-Warren Block * Rapid City, South Dakota USA

More information about the freebsd-questions mailing list