This is the mail archive of the cygwin@sources.redhat.com 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]

RE: How do I remove CR/LF from text file


> -----Original Message-----
> From: Brian Keener [mailto:bkeener@thesoftwaresource.com]
> Sent: Friday, February 02, 2001 7:03 PM
> To: cygwin
> Subject: Re: How do I remove CR/LF from text file
> 
> 
> Larry Hall wrote:
> > How about piping it through tr, mapping \n to \r\n?
> >
> I can't seem to get tr to exchange more than one character since I am 
> only starting with one character.
> 
>  tr "[\n]" "[\n\r]" < /tmp/foo >/windows/temp/foo2     no 
> apparent change
> 
>  tr "[\n]" "[\r]" < /tmp/foo >/windows/temp/foo2  No apparent 
> change when 
> looking in Notepad
> 
>  tr "[\n]" "[~]" < /tmp/foo >/windows/temp/foo2  all then newlines 
> changed to ~
> 
> Got any idea what I am doing wrong - I don't see any other flags or 
> switches that might make a difference.

Can't you directly generate your file as DOS text? either by writing on a
text-mount, or by explicitely writing to a file opened in text mode, by
open("...", O_WRONLY|O_TEXT) or fopen("...", "wt");

As you decribe the problem (wordpad understand the file but notepad displays
black rectangles instead of the EOL I think), you need not convert to UNIX
from DOS but the other way round: native Windows programs need CF/LF line
terminations -- at least old buggy ones like bug^H^H^Hnotepad :-)

HTH

	Bernard

--------------------------------------------
Bernard Dautrevaux
Microprocess Ingenierie
97 bis, rue de Colombes
92400 COURBEVOIE
FRANCE
Tel:	+33 (0) 1 47 68 80 80
Fax:	+33 (0) 1 47 88 97 85
e-mail:	dautrevaux@microprocess.com
		b.dautrevaux@usa.net
-------------------------------------------- 

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


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