Questions tagged [line-endings]

Line-ending signifies end of line. Depending on operating system line-endings are different.

516 questions
521
votes
38 answers

Convert ^M (Windows) line breaks to normal line breaks

Vim shows ^M on every line ending. How do I replace this with a normal line break in a file opened in Vim?
ByteNirvana
  • 5,640
  • 4
  • 21
  • 20
453
votes
12 answers

How to find out line-endings in a text file?

I'm trying to use something in bash to show me the line endings in a file printed rather than interpreted. The file is a dump from SSIS/SQL Server being read in by a Linux machine for processing. Are there any switches within vi, less, more,…
Marco Ceppi
  • 7,163
  • 5
  • 31
  • 43
438
votes
5 answers

Why should I use core.autocrlf=true in Git?

I have a Git repository that is accessed from both Windows and OS X, and that I know already contains some files with CRLF line-endings. As far as I can tell, there are two ways to deal with this: Set core.autocrlf to false everywhere, Follow the…
Rich
  • 7,348
  • 4
  • 34
  • 54
314
votes
22 answers

Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style

When using eslint in the gulp project i have encountered a problem with error like this Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style and I am using Windows environment for the running gulp and the entire error log is given below …
SaiKiran
  • 6,244
  • 11
  • 43
  • 76
301
votes
9 answers

What is the difference between \r and \n?

How are \r and \n different? I think it has something to do with Unix vs. Windows vs. Mac, but I'm not sure exactly how they're different, and which to search for/match in regexes.
Sam Lee
  • 9,913
  • 15
  • 48
  • 56
286
votes
9 answers

Trying to fix line-endings with git filter-branch, but having no luck

I have been bitten by the Windows/Linux line-ending issue with git. It seems, via GitHub, MSysGit, and other sources, that the best solution is to have your local repos set to use linux-style line endings, but set core.autocrlf to true. …
Brian Donahue
  • 3,052
  • 3
  • 17
  • 11
285
votes
12 answers

What does Visual Studio mean by normalize inconsistent line endings?

Visual Studio occasionally tells me: The line endings in the following files are not consistent. Do you want to normalize the line endings? It then gives me a drop down with different standards or something, such as Windows, Mac, Unix, and a…
MetaGuru
  • 42,847
  • 67
  • 188
  • 294
274
votes
8 answers

How to read lines of a file in Ruby

I was trying to use the following code to read lines from a file. But when reading a file, the contents are all in one line: line_num=0 File.open('xxx.txt').each do |line| print "#{line_num += 1} #{line}" end But this file prints each line…
draw
  • 4,696
  • 6
  • 31
  • 37
224
votes
9 answers

Convert line-endings for whole directory tree (Git)

Following situation: I'm working on a Mac running OS X and recently joined a project whose members so far all use Windows. One of my first tasks was to set up the codebase in a Git repository, so I pulled the directory tree from FTP and tried to…
Lunikon
  • 3,751
  • 4
  • 23
  • 20
214
votes
9 answers

Git status ignore line endings / identical files / windows & linux environment / dropbox / meld

How do I make git status ignore line ending differences? Background info: I use randomly Windows and Linux to work on the project. The project is in Dropbox. I found a lot about how do make git diff ignore line endings. Since i use meld git diff…
Thorsten Niehues
  • 13,712
  • 22
  • 78
  • 113
206
votes
6 answers

With Git, how do I turn off the "LF will be replaced by CRLF" warning

With Git, when using the autocrlf = true flag, a warning is still given when line-endings are changed. I understand what the warning is for, and how to turn off the line-ending flag, but how do I turn off the warning itself?
sent-hil
  • 18,635
  • 16
  • 56
  • 74
199
votes
11 answers

env: bash\r: No such file or directory

I'm trying to install YouCompleteMe from here. When I execute: ./install.sh --clang-completer I get this error: env: bash\r: No such file or directory I don't know what's wrong with environment variables. Here's my bash path: which bash…
Brijesh Rakholia
  • 2,095
  • 2
  • 12
  • 6
197
votes
15 answers

What are these ^M's that keep showing up in my files in emacs?

I think it may have to do with TextMate, but we work in a small team and are having some issues with full-file conflicts of nearly identical files in git – in one branch the files have a ^M appended to each line. What is this mysterious ^M character…
Neil Sarkar
  • 6,834
  • 8
  • 32
  • 30
180
votes
4 answers

Fixing Sublime Text 2 line endings?

Here is my Settings - User config: { "auto_indent": true, "color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme", "default_line_ending": "LF", "detect_indentation": true, "font_size": 10.0, "ignored_packages": …
mintobit
  • 2,363
  • 2
  • 15
  • 15
176
votes
10 answers

Is it possible for git-merge to ignore line-ending differences?

Is it possible for git merge to ignore line-ending differences? Maybe I'm asking the wrong question ... but: I tried uisng config.crlf input but things got a bit messy and out of control, specially when I applied it after the fact. For one thing,…
hasen
  • 161,647
  • 65
  • 194
  • 231
1
2 3
34 35