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]

"od" wrong line endings and byte count


cygwin:

When I create a file using notepad:

    This is a text file created with Notepad.
    It has DOS (CRLF) line endings.


Look at it using "wc":

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


And then look at it with Cygwin "od", I see:

dpchrist@p42800e:~$ od -Ad -tc 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   .  \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

Note the incorrect line endings ("\n") and byte count (74).


When I look at the same file using "od" from
http://unxutils.sourceforge.net/, I see:

dpchrist@p42800e:~$ od-unxutils -Ad -tc 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


Note the correct line endings ("\r \n") and byte count.


David

Attachment: cygcheck.out
Description: Binary data

Attachment: textfile.txt
Description: Text document

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