X-Spam-Check-By: sourceware.org
To: cygwin@cygwin.com
From: Matthew Woehlke <mwoehlke@tibco.com>
Subject:  Re: Bash 3.1.17(8): Scripts on textmode mount get problems with CR    characters
Date:  Fri, 27 Oct 2006 15:14:07 -0500
Lines: 31
Message-ID: <ehtpaf$v3c$1@sea.gmane.org>
References:  <ehticf$6rm$1@sea.gmane.org> <31DDB7BE4BF41D4888D41709C476B65704169286@NIHCESMLBX5.nih.gov>
Mime-Version:  1.0
Content-Type:  text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding:  7bit
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.0
In-Reply-To: <31DDB7BE4BF41D4888D41709C476B65704169286@NIHCESMLBX5.nih.gov>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Buchbinder, Barry (NIH/NIAID) [E] wrote:
> on Friday, October 27, 2006 2:16 PM, Matthew Woehlke wrote:
>> Long, Phillip GOSS wrote:
>>> U don't have d2u on all platforms, but U probably _do_ have awk or
>>> gawk on every platform.  I came up with a simple fix for the CRLF
>>> problem when I encountered it, which is still klugy, but works on
>>> every POSIX or Cygwin platform:
>>>    gawk '//' fileFromTextMount > fileWithLFOnlyOnBinMount
>> ...or:
>> $ cat <file> | tr -d '\r'
> 
> Save a cat:
> 	$ tr -d '\r' < <file> 

d'oh, right :-)

> or, if you might have other "\r"s in the file,
> 
> 	$ sed -e 's/\r$//' <file> 
> 
> Actually, just running something through sed seems to do it for me on a
> bin mount (though maybe this is just the same as running something
> through gawk).

I believe this works because *some* (not all IIRC) versions of sed read 
in text mode by default. The point of my original post, however, was 
that I am guessing that 'tr' is faster than sed/awk.

-- 
Matthew
"Two IIRC's must make a right" -- Larry Hall (paraphrased)


--
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/

