This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Re: Bash 3.1.17(8): Scripts on textmode mount get problems with CR characters


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]