On 6/27/06, David Mastronarde wrote:
On Sun, 25 Jun 2006, Dave wrote:
> David Mastronarde wrote:
>> After upgrading sed from 4.1.4 to 4.1.5, I found that line endings were
>> being converted from CRLF to CRCRLF when the input file was specified
>> with a windows file path:
>>
>> % sed -e 's/g5a/setname/g' < 'c:\cygwin\home\mast/sedtestin' > ! sedtestout
>>
>> Converting the path to cygwin format eliminated the problem.
>
> Have a read of http://cygwin.com/cygwin-ug-net/using-textbinary.html
>
> Try specifying the output file in MSDOS format, '.\sedtestout'.

I don't see the distinction between the redirection and the writing, and
also setting CYGWIN to nobinmode has no effect, so rule c does not seem to
be relevant.

If you set CYGWIN=nobinmode, I believe you will get newline
conversions done across pipes. In your example, you are only using
redirections. I would advise that you don't set it.

But also, specifying output as '.\sedtestout' did NOT solve the problem,
even with nobinmode in effect.  So rule b is governing the input but is
not being applied on output.

Works for me - see attached session output.

Dave.
$ pwd
/tmode

$ mount
c:\cygwin\home\dkilroy\tmode on /tmode type user (textmode)
c:\cygwin\bin on /usr/bin type system (binmode)
c:\cygwin\bin on /bin type system (binmode,exec)
c:\cygwin\lib on /usr/lib type system (binmode)
c:\cygwin on / type system (binmode)

$ echo $CYGWIN


$ od -a correct.txt 
0000000   T   h   i   s  sp   f   i   l   e  cr  nl   s   h   o   u   l
0000020   d  sp   h   a   v   e  sp   D   O   S  sp   l   i   n   e  sp
0000040   e   n   d   i   n   g   s  cr  nl
0000051

$ cygcheck -c sed cygwin
Cygwin Package Information
Package              Version        Status
cygwin               1.5.19-4       OK
sed                  4.1.5-1        OK

$ sed s/lin/line/g < "c:\cygwin\home\dkilroy\tmode\original.txt" > 
posix_out.txt 

$ sed s/lin/line/g < "c:\cygwin\home\dkilroy\tmode\original.txt" > 
".\dos_out.txt"

$ od -a posix_out.txt 
0000000   T   h   i   s  sp   f   i   l   e  cr  cr  nl   s   h   o   u
0000020   l   d  sp   h   a   v   e  sp   D   O   S  sp   l   i   n   e
0000040  sp   e   n   d   i   n   g   s  cr  cr  nl
0000053

$ od -a dos_out.txt 
0000000   T   h   i   s  sp   f   i   l   e  cr  nl   s   h   o   u   l
0000020   d  sp   h   a   v   e  sp   D   O   S  sp   l   i   n   e  sp
0000040   e   n   d   i   n   g   s  cr  nl
0000051
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply via email to