delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/10/27/15:31:04

X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
Subject: RE: Re: Bash 3.1.17(8): Scripts on textmode mount get problems with CR characters
Date: Fri, 27 Oct 2006 15:30:37 -0400
Message-ID: <31DDB7BE4BF41D4888D41709C476B65704169286@NIHCESMLBX5.nih.gov>
In-Reply-To: <ehticf$6rm$1@sea.gmane.org>
From: "Buchbinder, Barry \(NIH/NIAID\) [E]" <BBuchbinder AT niaid DOT nih DOT gov>
To: <cygwin AT cygwin DOT com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id k9RJV050008221

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> 

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).

	$ echo xxxY | tr Y \\r | od -c
	0000000   x   x   x  \r  \n
	0000005
	$ echo xxxY | tr Y \\r | sed -e 's/asdf/asdf/' | od -c
	0000000   x   x   x  \n
	0000004

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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019