[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sed on binary files

From: Ralf Wildenhues
Subject: Re: sed on binary files
Date: Thu, 2 Oct 2008 07:32:53 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hi Eric,

* Eric Blake wrote on Thu, Oct 02, 2008 at 04:51:58AM CEST:
> Is there any portable way to process files that contain NUL bytes?

tr?  If you only need to compare for equality, then use cmp.

> The Solaris man
> pages mention that /usr/xpg4/bin/tr can handle NUL bytes, but not
> /usr/bin/tr; maybe I could search for an adequate tr, and change all NUL
> to some other byte that does not otherwise appear in my expected output
> (with the added benefit that diff might not give up early with the
> complaint that the files are binary), but I don't know if that is portable
> either.

That's what I'd try first, too.

> Any suggestions?  Is this worth documenting in the autoconf manual?

I guess the bit that Solaris /usr/bin/tr is deficient, is (what about
other vendors' tr?).  I wouldn't recommend a way to treat binary files
in the manual, until there is actual experience with it, and then only
if that deviates substantially from what Posix says.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]