I intend to write some text file in both windows and Unix (Ubuntu) but when i save it the file sizes are different, why is that so?
NickName:bulldog Ask DateTime:2021-08-02T19:54:31

I intend to write some text file in both windows and Unix (Ubuntu) but when i save it the file sizes are different, why is that so?

I intend to write the following text file in both windows and Unix (Ubuntu):

Today is Wednesday.
Tomorrow is Thursday.
End of File.

When I save it on Windows it is 56 bytes long. On Ubuntu it is 54 bytes long. Explain the difference please.

Copyright Notice:Content Author:「bulldog」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/68621145/i-intend-to-write-some-text-file-in-both-windows-and-unix-ubuntu-but-when-i-sa

Answers
izzy 2021-08-02T11:59:13

Traditionally, windows uses both \\r (carriage return) and \\n (line feed) to indicate end of line, while Linux uses only \\n. This could explain a difference, depending on how many newlines you had, and possibly the encoding of the file.",


More about “I intend to write some text file in both windows and Unix (Ubuntu) but when i save it the file sizes are different, why is that so?” related questions

I intend to write some text file in both windows and Unix (Ubuntu) but when i save it the file sizes are different, why is that so?

I intend to write the following text file in both windows and Unix (Ubuntu): Today is Wednesday. Tomorrow is Thursday. End of File. When I save it on Windows it is 56 bytes long. On Ubuntu it is 54...

Show Detail

Subprocess code to convert unix text file to windows

I wrote a program to convert unix text files to be readable in Windows. The program executes inside a Linux machine. The Python code I use to convert is: subprocess.Popen('''awk 'sub("$", "\r")' u...

Show Detail

write a text file for unix vb.net

I need to write some text in a new file, the strings I have to write are command and I need the file properly formatted. The machines where I run it is linux based so the file has to be compliant t...

Show Detail

File type in java (Windows,unix)

I implemented a code that takes input file from command line. Then, sorts this input. Then write output to current directory. My code works but I am wondering that type of file. My input.txt type i...

Show Detail

Powershell command to identify all the Windows type and UNIX type text file

The GIT is messing up few files and it saves the unix based files in LF format in the system. There is also few of the windows file that gets saved in CR LF format. I need to differentiate between ...

Show Detail

File moving command works on both Unix and Windows

I need to write a simple command that works on both Unix and Windows that move a file from one directory to another directory(E.g: 2 files with the same name movingfile.sh and moveingfile.bat). Any...

Show Detail

Why can I view some Unix executable files in Mac OS X and not others?

I am on a Macbook Pro on Mac OS X 10.10 (Yosemite). When I go to /usr/bin, git is there as a unix executable file. When I open it up in Sublime Text, all I get is unreadable machine code. However, ...

Show Detail

telnet Unix/Linux and download the file to local Windows system

Is it possible to do so: I am on Windows system and telnet Unix/Linux remotely. Then I would like to download file from telnet mode and download to Windows system. Any Unix/Linux command are able ...

Show Detail

Could Not find windows command to convert dos file to unix

The scenario where I am stuck is that I have a normal windows text file 'command.txt' which I am copying on remote(unix) server from my local machine(windows) using 'pscp' command from cmd. The f...

Show Detail

Concurrent file write in Java on Windows

What happens when you concurrently open two (or more) FileOutputStreams on the same file? The Java API says this: Some platforms, in particular, allow a file to be opened for writing by only one

Show Detail