expand changing DOS line endings to Unix line endings

David Christensen dpchrist@holgerdanske.com
Mon Jan 3 02:51:00 GMT 2005


Gerrit P. Haase wrote:
> I took the textfile from the attachment which has actually two \r\n
> at the end which are 78 bytes at all:

Thanks for your suggestion.  I believe my copy of textfile.txt has one
CRLF pair at the end, and the length is 76 bytes:

dpchrist@p42800e:~$ wc textfile.txt
 2 14 76 textfile.txt
dpchrist@p42800e:~$ wc textfile.out
 2 14 74 textfile.out


Also:

C:\cygwin\home\dpchrist>dir textfile.txt
 Volume in drive C is P42800E
 Volume Serial Number is 80A2-A98F

 Directory of C:\cygwin\home\dpchrist

01/02/2005  12:00 PM                76 textfile.txt
               1 File(s)             76 bytes
               0 Dir(s)  66,820,841,472 bytes free

C:\cygwin\home\dpchrist>type textfile.txt
This is a text file created with Notepad.
It has DOS (CRLF) line endings.

C:\cygwin\home\dpchrist>


> This is on a textmode mount and I see the same on a binmode mount.

I do not understand the subtleties of Cygwin textmode mounts and binmode
mounts.  I do not recall taking any actions to affect this parameter --
my habit is to simply download Cygwin setup.exe, download packages to
the local disk, and install packages from the local disk.  When I
suspect my Cygwin installation is corrupt, I rename C:\cygwin, do a
fresh download/ download/ install cycle, and move over my data.  (Maybe
I need to do this again?)


> ... please install coreutils to replace all these three packages.

Using ftp:://planetmirror.com, 5.2.1-4 appears to be the most recent
version of coreutils and it looks like I already have it installed (also
confirmed by the attached cygcheck.out).  The three previous mirrors on
the list also indicate 5.2.1-4 is current.  Is there a newer release?
Do I need to find a better mirror?


Reinstalling coreutils 5.2.1-4 anyway does not cure the problem:

dpchrist@p42800e:~$ grep dump .bashrc
alias dump='od -Ad -tc'
dpchrist@p42800e:~$ dump textfile.txt
0000000   T   h   i   s       i   s       a       t   e   x   t       f
0000016   i   l   e       c   r   e   a   t   e   d       w   i   t   h
0000032       N   o   t   e   p   a   d   .  \r  \n   I   t       h   a
0000048   s       D   O   S       (   C   R   L   F   )       l   i   n
0000064   e       e   n   d   i   n   g   s   .  \r  \n
0000076
dpchrist@p42800e:~$ expand textfile.txt > textfile.out
dpchrist@p42800e:~$ dump textfile.out
0000000   T   h   i   s       i   s       a       t   e   x   t       f
0000016   i   l   e       c   r   e   a   t   e   d       w   i   t   h
0000032       N   o   t   e   p   a   d   .  \n   I   t       h   a   s
0000048       D   O   S       (   C   R   L   F   )       l   i   n   e
0000064       e   n   d   i   n   g   s   .  \n
0000074


David
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: textfile.txt
URL: <http://cygwin.com/pipermail/cygwin/attachments/20050103/a4d02834/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 16241 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20050103/a4d02834/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: textfile.out
Type: application/octet-stream
Size: 75 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20050103/a4d02834/attachment-0001.obj>
-------------- next part --------------
--
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/


More information about the Cygwin mailing list