Questions tagged [line-endings]

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

516 questions
134
votes
17 answers

'Incomplete final line' warning when trying to read a .csv file into R

I'm trying to read a .csv file into R and upon using this formula: pheasant<-read.table(file.choose(),header=TRUE,sep=",") I get this warning message: "incomplete final line found by readTableHeader on 'C:\Documents and Settings..." There are a…
Kate
  • 1,351
  • 2
  • 10
  • 4
129
votes
11 answers

How can I make all line endings (EOLs) in all files in Visual Studio Code, Unix-like?

I use Windows 10 Home and I usually use Visual Studio Code (VS Code) to edit Linux Bash scripts as well as PHP and JavaScript. I don't develop anything dedicated for Windows and I wouldn't mind that the default EOLs for all files I edit whatsoever…
Osi
  • 1
  • 3
  • 9
  • 30
109
votes
5 answers

git diff - show me line ending changes?

My editor is changing the line endings of my source files. When I do git diff, I see the same line twice -- once with - and once with + -- with no visible difference. How do I get git diff to show me what this change actually was?
Stonky
  • 1,141
  • 2
  • 7
  • 6
109
votes
8 answers

How to normalize working tree line endings in Git?

I have cloned a repository that had inconsistend line endings. I have added a .gitattributes that sets the text attribute for the files I want to normalize. Now when I commit changes I get the message: warning: CRLF will be replaced by LF in…
user11171
  • 3,821
  • 5
  • 26
  • 35
106
votes
5 answers

Why does Windows use CR LF?

I understand the difference between the two so there's no need to go into that, but I'm just wondering what the reasoning is behind why Windows uses both CR and LF to indicate a line break. It seems like the Linux method (just using LF) makes a lot…
Kyle
  • 4,261
  • 11
  • 46
  • 85
104
votes
17 answers

'^M' character at end of lines

When I run a particular SQL script in Unix environments, I see a '^M' character at the end of each line of the SQL script as it is echoed to the command line. I don't know on which OS the SQL script was initially created. What is causing this and…
Paul Reiners
  • 8,576
  • 33
  • 117
  • 202
100
votes
10 answers

Configure Visual Studio to use UNIX line endings

We would like to use Visual Studio 2005 to work on a local copy of an SVN repository. This local copy has been checked out by Mac OS X (and updates and commits will only be made under Mac OS X, so no problem there), and as a consequence the line…
moala
  • 5,094
  • 9
  • 45
  • 66
97
votes
4 answers

Python get proper line ending

Is there an easy way to get the type of line ending that the current operating system uses?
Evan Fosmark
  • 98,895
  • 36
  • 105
  • 117
87
votes
13 answers

What's a quick one-liner to remove empty lines from a python string?

I have some code in a python string that contains extraneous empty lines. I would like to remove all empty lines from the string. What's the most pythonic way to do this? Note: I'm not looking for a general code re-formatter, just a quick one or…
Andrew Wagner
  • 22,677
  • 21
  • 86
  • 100
83
votes
1 answer

What is the meaning of ^M in 'git diff'?

I am diffing a file between forked and upstream Bitbucket repositories: $ git diff origin/branchA..upstream/branchB -- some/file/path.xyz It seems to return the same difference for almost every file: -@using Sitecore.Mvc +@using…
Moo
  • 3,369
  • 4
  • 22
  • 41
82
votes
10 answers

gVim showing carriage return (^M) even when file mode is explicitly DOS

I'm using gVim on Windows. My code shows ^M characters at the end of lines. I used :set ff=dos to no avail. The ^M characters remain for existing lines, but don't show up for newlines I enter. I've switched modes to mac (shows ^J characters) and…
Jerph
  • 4,572
  • 3
  • 42
  • 41
77
votes
10 answers

How can I write a ESLint rule for "linebreak-style", changing depending on Windows or Unix?

As we all know, the linebreaks (new line) used in Windows are usually carriage returns (CR) followed by a line feed (LF) i.e. (CRLF) whereas, Linux and Unix use a simple line feed (LF) Now, in my case, my build server uses supports Linux and Unix…
Ravindra Thorat
  • 1,822
  • 1
  • 17
  • 24
67
votes
6 answers

How do I force unix (LF) line endings in Visual Studio (Express) 2008?

Is there a way to always have LF line endings in Visual Studio? I can never seem to find it!
64
votes
7 answers

What's the difference between \n and \r\n?

They both mean "new line" but when is one used over the other?
Emanuil Rusev
  • 34,563
  • 55
  • 137
  • 201
62
votes
10 answers

How can I redirect PowerShell output when run from Task Scheduler?

When running a simple PowerShell script from Task Scheduler, I would like to redirect the output to a file. There is a long thread about this very topic here, yet it's not clear if they reached the most appropriate solution in the end. I'm…
cmcginty
  • 113,384
  • 42
  • 163
  • 163
1
2
3
34 35