bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: sed question about newline -> cr/lf conversion


From: Hans-Bernhard Broeker
Subject: Re: sed question about newline -> cr/lf conversion
Date: 17 Apr 2002 09:34:11 GMT

Lynn Wilson <address@hidden> wrote:

> If I run sed on a binary executable file that perchance has \n (0xa)
> characters in it, the resulting output (without substitution) has
> those changed to CR-LF.  Is there a way to disable this conversion?
> I'm running cygwin on a MS-Win2K system.

You cannot really use text-oriented tools (like sed) on non-text files
on MS Windows the same way as you could on Unix, where there is no
real difference between the two types of file.  A program that
modifies text files on Windows has to choose between two evils:

1) Creating text files that lots of Windows-native programs can't handle 
   properly because they have Unix-style line ends

2) Make a complete mess of any non-text files the tool is applied to.

There's a third option: look at the actual file contents to find out
whether it's a text file or not, and only write a Windows-compatible
text file if the input was text, too.

Looks like the sed port you have chose option 2).  Your Cygwin 'mount'
options also have some influence on that, so you'll want to check
those.

> I really don't want to modify the application to test for file type prior to
> running sed on it.

I doubt there's any way to avoid that.  
-- 
Hans-Bernhard Broeker (address@hidden)
Even if all the snow were burnt, ashes would remain.



reply via email to

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