in reply to Re: Ascii upload ruins the file
in thread Ascii upload ruins the file

No, Unix does indeed use only \x0A as the line terminator.

$ cat > test this is a test this is a test this is a test 12345678901234 $ od -t x1 test 000000 74 68 69 73 20 69 73 20 61 20 74 65 73 74 0a 74 000020 68 69 73 20 69 73 20 61 20 74 65 73 74 0a 74 68 000040 69 73 20 69 73 20 61 20 74 65 73 74 0a 31 32 33 000060 34 35 36 37 38 39 30 31 32 33 34 0a 000074 $ \ls -l test -rw------- 1 ikegami users 60 May 19 09:40 test

Not only do you see only "0a" without any "0d" in the binary dump, The file size indicates FreeBSD uses only one (60/4 - 14 = 1) character for the newline. From experience, the same applies to Linux, SunOS/Solaris and AIX. The Macs do something different, but I'm not sure what.

Replies are listed 'Best First'.
Re^3: Ascii upload ruins the file
by osunderdog (Deacon) on May 19, 2005 at 19:00 UTC

    Here is the Mac (OS X) output:

    brucelowther:~ brucelowther$ cat > ~/tmp/test.txt this is a test this is a test this is a test 12345678901234 brucelowther:~ brucelowther$ hexdump -C ~/tmp/test.txt 00000000 74 68 69 73 20 69 73 20 61 20 74 65 73 74 0a 74 |this is a + test.t| 00000010 68 69 73 20 69 73 20 61 20 74 65 73 74 0a 74 68 |his is a +test.th| 00000020 69 73 20 69 73 20 61 20 74 65 73 74 0a 31 32 33 |is is a t +est.123| 00000030 34 35 36 37 38 39 30 31 32 33 34 0a |456789012 +34.| 0000003c

    Unemployed!