Questions tagged [eol]

EOL is short for "end of line". In text files each line is terminated with characters such as linefeed or carriage return or a combination thereof.

EOL stands for "end of line" and refers to the various character or combination of characters that signify the end of each line of a text-based file.

For historical reasons there are various common EOLs:

  • linefeed or newline, ASCII 0x0A: common on systems with Unix heritage including Mac OS X
  • carriage return + linefeed, ASCII 0x0D 0x0A: common on systems with Microsoft DOS and Windows heritage and in text-based internet protocols
  • carriage return, ASCII 0x0D: used on Apple Macintosh up to System 7

These differences can present problems when using files and source code on multiple operating systems. Issues may be encountered with text editors, compilers, and revision controls systems.

See also

380 questions
46
votes
4 answers

PHP Echo Line Breaks

What's the difference between \n and \r (I know it has something to do with OS), and what's the best way to echo a line break that will work cross platform? EDIT: In response to Jarod, I'll be using ths to echo a line break in a .txt log file,…
PHLAK
  • 22,023
  • 18
  • 49
  • 52
46
votes
7 answers

Replace CRLF using powershell

Editor's note: Judging by later comments by the OP, the gist of this question is: How can you convert a file with CRLF (Windows-style) line endings to a LF-only (Unix-style) file in PowerShell? Here is my powershell script: $original_file…
Angel_Boy
  • 958
  • 2
  • 7
  • 16
41
votes
8 answers

How do I hide the eol doc chars ^M in VIM

In gvim on windows if I have text with CRLF eol then the text will display ^M at the end of each line. How do I 'hide' that special char from display? The :set nolist command """ does not dismiss it. UPDATE I did :set fileformats=unix,dos as a list.…
marekj
  • 1,235
  • 2
  • 10
  • 11
39
votes
2 answers

How can I ignore eol changes and all white space in svn?

Combining svn diff --ignore-eol-style and --ignore-all-space is not working: $ svn diff -x -w --ignore-eol-style -r 1143:1177 somefile svn: invalid option: --ignore-eol-style And, $ svn diff -x --ignore-eol-style -x --ignore-all-space -r 1143:1177…
user420095
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
36
votes
1 answer

How does git-svn handle line endings?

I'm pretty happy with how Git itself handles line endings, via core.autocrlf, core.eol + gitattributes (Tim's post is excellent). I have a Windows Git repo that has autocrlf set to true. So, all text files are stored in the repo as LF and live in…
citizenmatt
  • 18,085
  • 5
  • 55
  • 60
31
votes
4 answers

What does "!eol" in gitattributes do?

Recently I came across the following entry in a .gitattributes file: "* text=auto !eol" What does !eol do?
user3226810
  • 319
  • 1
  • 3
  • 3
27
votes
5 answers

How do I get patch to ignore carriage returns?

I'm attempting to apply a patch to a file with Windows line endings on a Linux system and I'm getting conflicts due to the carriage returns in the file. The -l option (ignore whitespace) isn't ignoring the EOL characters. Is there anyway to get…
James McMahon
  • 48,506
  • 64
  • 207
  • 283
25
votes
5 answers

On windows, how would I detect the line ending of a file?

I've seen answers to the questions, but those answers are not from a windows perspective from what I can tell. Windows uses CR LF, Unix uses LF, Mac uses LF and classic mac uses something else. I don't have the brainpower to tell that somehow, if a…
13steinj
  • 427
  • 2
  • 9
  • 16
24
votes
5 answers

Python file.write creating extra carriage return

I'm writing a series of SQL statements to a file using python. The template string looks like: store_insert = '\tinsert stores (storenum, ...) values (\'%s\', ...)' I'm writing to the file like so: for line in source: line = line.rstrip() …
Chris
  • 27,596
  • 25
  • 124
  • 225
24
votes
5 answers

How can I convert all line endings to CRLF, LF, or CR during SVN operations

So, you are all ready to do a big SVN Commit and it bombs because you have inconsistent line endings in some of your files. Fun part is, you're looking at 1,000s of files spanning dozens of folders of different depths. What do you do?
Brett Veenstra
  • 47,674
  • 18
  • 70
  • 86
24
votes
4 answers

Is there anyway to get TortoiseSVN to leave EOL (line endings) as is?

I'm checking out files that have Linux style line endings (just LF char). When I check out a file with TortoiseSVN in Windows, it converts the line endings to Windows style (CR+LF). I've tried adding the lines to the subversion config file to force…
Brent212
  • 1,835
  • 4
  • 19
  • 23
22
votes
6 answers

How to change the line ending used in Netbeans

Netbeans has this wiki entry on line endings: http://wiki.netbeans.org/FaqEditorEOLs But it isn't very useful. It just says that you shouldn't develop on different OS and that's that... In my situation however, I have no power over it. I'm on a…
KdgDev
  • 14,299
  • 46
  • 120
  • 156
21
votes
7 answers

How do I use System.getProperty("line.separator").toString()?

I have a Tab-delimited String (representing a table) that is passed to my method. When I print it to the command line, it appears like a table with rows: https://i.stack.imgur.com/2fAyq.gif The command window is correctly buffered. My thinking is…
ejsuncy
  • 419
  • 1
  • 4
  • 13
20
votes
1 answer

Show only whitespaces in Atom (not EOL)

If I choose Show Invisibles in Atom settings, then all invisible characters become visible: I would like to hide EOLs, because they pollute the view. Is this achievable?
imkost
  • 8,033
  • 7
  • 29
  • 47
1
2
3
25 26