Questions tagged [linefeed]

Linefeed, also known as LF, is a character that controls the switching to the next line.

Linefeed, also known as LF, is a character that controls the switching to the next line.

303 questions
1799
votes
2 answers

LF will be replaced by CRLF in git - What is that and is it important?

git init git add . Gives the following warnings for many files: The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in . What's the difference between LF and CRLF? What should I…
LearningRoR
  • 26,582
  • 22
  • 85
  • 150
1211
votes
25 answers

Git replacing LF with CRLF

On a Windows machine, I added some files using git add. I got warnings saying: LF will be replaced by CRLF What are the ramifications of this conversion?
mrblah
  • 99,669
  • 140
  • 310
  • 420
1111
votes
10 answers

Difference between CR LF, LF and CR line break types

I'd like to know the difference (with examples if possible) between CR LF (Windows), LF (Unix) and CR (Macintosh) line break types.
eozzy
  • 66,048
  • 104
  • 272
  • 428
818
votes
29 answers

Convert DOS/Windows line endings to Linux line endings in Vim

If I open files I created in Windows, the lines all end with ^M. How do I delete these characters all at once?
Bert Hekman
  • 8,987
  • 3
  • 21
  • 14
745
votes
11 answers

Bash script – "/bin/bash^M: bad interpreter: No such file or directory"

I'm using this tutorial to learn bash scripts to automate a few tasks for me. I'm connecting to a server using putty. The script, located in .../Documents/LOG, is: #!/bin/bash # My first script echo "Hello World!" And I executed the following for…
cartonn
  • 7,654
  • 3
  • 19
  • 19
680
votes
9 answers

What's the strategy for handling CRLF (carriage return, line feed) with Git?

I tried committing files with CRLF-ending lines, but it failed. I spent a whole work day on my Windows computer trying different strategies and was almost drawn to stop trying to use Git and instead try Mercurial. How to properly handle CRLF line…
Daniel Jomphe
  • 16,991
  • 5
  • 29
  • 30
646
votes
13 answers

What are carriage return, linefeed, and form feed?

What is the meaning of the following control characters: Carriage return Line feed Form feed
ashna
  • 7,159
  • 4
  • 20
  • 9
638
votes
15 answers

What does the ^M character mean in Vim?

I keep getting the ^M character in my .vimrc and it breaks my configuration.
Max
  • 6,383
  • 3
  • 15
  • 6
587
votes
6 answers

How do I force Git to use LF instead of CR+LF under Windows?

I want to force Git to check out files under Windows using just LF not CR+LF. I checked the two configuration options, but was not able to find the right combination of settings. I want to convert all files to have LF line breaks and keep the LF in…
sorin
  • 161,544
  • 178
  • 535
  • 806
439
votes
23 answers

How to convert DOS/Windows newline (CRLF) to Unix newline (LF)

How can I programmatically (not using vi) convert DOS/Windows newlines to Unix newlines? The dos2unix and unix2dos commands are not available on certain systems. How can I emulate them with commands such as sed, awk, and tr?
Koran Molovik
  • 4,415
  • 3
  • 16
  • 3
402
votes
10 answers

How to make IntelliJ IDEA insert a new line at every end of file?

How do I make IntelliJ IDEA insert a new line at every end of file, so that GitHub doesn't complain for example?
NightRa
  • 10,701
  • 3
  • 16
  • 22
293
votes
4 answers

What is the difference between a "line feed" and a "carriage return"?

If there are two keywords then they must have their own meanings. So I want to know what makes them different and what their code is.
pheromix
  • 18,213
  • 29
  • 88
  • 158
149
votes
9 answers

^M at the end of every line in Vim

When I am editing source files using Vim and other editors, sometimes I get these ^M characters at the end of each line. I think that it has something to do with editing a file on Windows and then on Linux. How can I remove all of these…
DHamrick
  • 8,338
  • 9
  • 45
  • 62
136
votes
13 answers

Removing carriage return and linefeed from the end of a string in C#

How do I remove the carriage return character (\r) and the Unix newline character(\n) from the end of a string?
Avik
  • 2,097
  • 7
  • 24
  • 30
129
votes
4 answers

Writing a new line to file in PHP (line feed)

My code: $i = 0; $file = fopen('ids.txt', 'w'); foreach ($gemList as $gem) { fwrite($file, $gem->getAttribute('id') . '\n'); $gemIDs[$i] = $gem->getAttribute('id'); $i++; } fclose($file); For some reason, it's writing \n as a string, so…
VIVA LA NWO
  • 3,852
  • 6
  • 24
  • 21
1
2 3
20 21