X-Spam-Check-By: sourceware.org Message-ID: <449EF283.80500@gmail.com> Date: Sun, 25 Jun 2006 21:30:59 +0100 User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) MIME-Version: 1.0 To: David Mastronarde CC: cygwin AT cygwin DOT com Subject: Re: sed 4.1.5 adds extra CR with input file path in Windows format References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit From: Dave Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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. > > C:\cygwin / system textmode > C:\cygwin/bin /usr/bin system textmode > C:\cygwin/lib /usr/lib system textmode > C:\cygwin\usr\X11R6\lib\X11\fonts /usr/X11R6/lib/X11/fonts system binmode > . /cygdrive system textmode,cygdrive Have a read of http://cygwin.com/cygwin-ug-net/using-textbinary.html Stepping through it: % sed -e 's/g5a/setname/g' < 'c:\cygwin\home\mast/sedtestin' > ! sedtestout rule b. sedtestin input will be read in binary mode. i.e it reads \r\n redirection of input is done in binmode from rule c. ditto output redirection. writing of the file is done in textmode due to your mounts (rule a). Hence \r\n coming out of sed becomes \r\r\n. Try specifying the output file in MSDOS format, '.\sedtestout'. Dave. -- 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/