Line-ending signifies end of line. Depending on operating system line-endings are different.
Questions tagged [line-endings]
516 questions
60
votes
12 answers
Hiding ^M in Emacs
Sometimes I need to read log files that have ^M (control-M) in the line endings. I can do a global replace to get rid of them, but then something more is logged to the log file and, of course, they all come back.
Setting Unix-style or dos-style…
Russell
59
votes
2 answers
Does Python csv writer always use DOS end-of-line characters?
I realize that the csv library in Python always generates DOS end-of-line characters. Even if I use the 'wb' mode, even if I use Linux.
import csv
f = open('output.txt', 'wb');
writer = csv.writer(f)
writer.writerow([2,3,4]);
f.close()
The above…

CuriousMind
- 15,168
- 20
- 82
- 120
59
votes
4 answers
How to fix inconsistent line endings for whole VS solution?
Visual Studio will detect inconsistent line endings when opening a file and there is an option to fix it for that specific file. However, if I want to fix line endings for all files in a solution, how do I do that?

Borek Bernard
- 50,745
- 59
- 165
- 240
55
votes
6 answers
Carriage Return\Line feed in Java
I have created a text file in Unix environment using Java code.
For writing the text file I am using java.io.FileWriter and BufferedWriter. And for newline after each row I am using bw.newLine() method (where bw is object of BufferedWriter).
And I'm…

Manu
- 3,179
- 23
- 57
- 69
53
votes
7 answers
How to determine the line ending of a file
I have a bunch (hundreds) of files that are supposed to have Unix line endings. I strongly suspect that some of them have Windows line endings, and I want to programmatically figure out which ones do.
I know I can just run flip -u or something…

nwahmaet
- 3,589
- 3
- 28
- 35
51
votes
4 answers
How to see what type of line endings are already in git repository?
First of all, I'm not asking what does it mean or how to change it. The thing what interest me most is: how can I see what's already in repo? What type of line endings.
I have my repositories on github and bitbucket.
Thanks for help

Ivan Bara
- 565
- 1
- 5
- 7
49
votes
2 answers
PhpStorm saving with Linux line ending on Windows
Environment: Windows + PhpStorm
Issue: PhpStorm saves file with Windows line endings - and for shell script it's issue so there is need to always convert after copying to server.
Question: Is possible to configure PhpStorm to save file with Linux…

Jurosh
- 6,984
- 7
- 40
- 51
48
votes
4 answers
Automatic EOL conversion in Eclipse
Need to keep EOL format consistent in all resources under Eclipse workspace.
I know about Eclipse preference that sets new line style for newly created files, but I would like to have automatic conversion for already existing files. Is there some…

Ilya Ivanov
- 2,379
- 1
- 21
- 24
48
votes
9 answers
How can I normalize the EOL character in Java?
I have a linux server and many clients with many operating systems. The server takes an input file from clients. Linux has end of line char LF, while Mac has end of line char CR, and
Windows has end of line char CR+LF
The server needs as end of line…

bilal
- 725
- 1
- 9
- 16
47
votes
3 answers
Definitive recommendation for git autocrlf settings
I use Windows, Mac OS X and linux on a daily basis. I use git in all these environments, pulling from repos that are used by folks with different choices for line endings.
Are there definitive recommendation for setting core.autocrlf in my…

rbellamy
- 5,683
- 6
- 38
- 48
45
votes
3 answers
Python 2 CSV writer produces wrong line terminator on Windows
According to the its documentation csv.writer should use '\r\n' as lineterminator by default.
import csv
with open("test.csv", "w") as f:
writer = csv.writer(f)
rows = [(0,1,2,3,4),
(-0,-1,-2,-3,-4),
…

wierob
- 4,299
- 1
- 26
- 27
42
votes
7 answers
git line endings - can't stash, reset and now can't rebase over spurious line endings commit
I have a repo I added a gitattributes to it and was working on it fine. I sync it via dropbox to another machine. When I opened it to the other machine a bunch of files suddenly appeared on the unstaged area as total diffs (all the file a huge diff…

Mr_and_Mrs_D
- 32,208
- 39
- 178
- 361
41
votes
10 answers
How to strip CR (^M) and leave LF (^J) characters?
I am trying to use Hexl mode to manually remove some special characters from a text file and don't see how to delete anything in Hexl mode.
What I really want is to remove carriage return and keep linefeed characters.
Is Hexl mode the right way to…

Brandon Leiran
- 5,343
- 3
- 20
- 17
40
votes
22 answers
How should I Fix "svn: Inconsistent line ending style"?
When I run "svn propedit svn:ignore ." at the root of my svn repository, I get this error:
svn: Inconsistent line ending style
I have tried to run this script: http://blog.eflow.org/archives/130 which runs dos2unix and sets the eol-style on all of…

Kelvin
- 965
- 2
- 10
- 13
37
votes
4 answers
Historical reason behind different line ending at different platforms
Why did DOS/Windows and Mac decide to use \r\n and \r for line ending instead of \n? Was it just a result of trying to be "different" from Unix?
And now that Mac OS X is Unix (-like), did Apple switch to \n from \r?

Imran
- 87,203
- 23
- 98
- 131