Sample Header Ad - 728x90

Is a text file bigger on Windows than on Linux because of carriage return?

0 votes
2 answers
1279 views
Let's say I have the same ASCII text file on Linux and Windows:
one
two
three
The two files will have \n and \r\n respectively as EOL character on the two OSes. Does this mean that the file on Linux is smaller? This test, performed on linux, seems say yes:
$ echo -en 'one\ntwo\nthree\n' | wc --bytes 
14
$ echo -en 'one\r\ntwo\r\nthree\r\n' | wc --bytes 
17
Asked by Enlico (2258 rep)
Sep 7, 2020, 09:08 AM
Last activity: Sep 7, 2020, 02:15 PM