Questions tagged [linefeed]
Linefeed, also known as LF, is a character that controls the switching to the next line.
305
questions
1831
votes
2
answers
2.0m
views
LF will be replaced by CRLF in git - What is that and is it important? [duplicate]
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 <filename>.
...
1247
votes
26
answers
1.0m
views
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?
1163
votes
10
answers
1.7m
views
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.
831
votes
29
answers
698k
views
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?
788
votes
11
answers
1.2m
views
Bash script – "/bin/bash^M: bad interpreter: No such file or directory" [duplicate]
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 &...
689
votes
9
answers
259k
views
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 ...
669
votes
13
answers
694k
views
What are carriage return, linefeed, and form feed?
What is the meaning of the following control characters:
Carriage return
Line feed
Form feed
662
votes
15
answers
446k
views
What does the ^M character mean in Vim?
I keep getting the ^M character in my .vimrc and it breaks my
configuration.
618
votes
7
answers
434k
views
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 ...
449
votes
23
answers
627k
views
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 ...
424
votes
10
answers
133k
views
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?
298
votes
4
answers
381k
views
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.
150
votes
11
answers
102k
views
^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 ...
139
votes
13
answers
243k
views
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?
131
votes
4
answers
391k
views
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($...
109
votes
16
answers
68k
views
Are shell scripts sensitive to encoding and line endings?
I am making an NW.js app on macOS, and want to run the app in dev mode
by double-clicking on an icon.
In the first step, I'm trying to make my shell script work.
Using VS Code on Windows (I wanted to ...
108
votes
5
answers
54k
views
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 ...
85
votes
14
answers
159k
views
PHP: Telegram Bot: Insert line break to text message
"\n" and "\r\n", tested in text message sent by telegram bot, to create line break. Instead of showing line break, underline _ will appear after using them.
How I could printing line feed in ...
66
votes
9
answers
208k
views
In C#, what's the difference between \n and \r\n?
In C#, what's the difference between \n and \r\n?
55
votes
6
answers
242k
views
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() ...
49
votes
1
answer
193k
views
How to add a newline (line break) in an XML file?
I have an XML file and I would like to make a new line in the text
"Sample Text 123" like this
Sample
Text 123
I've tried already everything I mean 
 
 \n but nothing works:
...
43
votes
11
answers
97k
views
Anything like dos2unix for Windows?
I have some shell scripts created on Windows.
I want to run dos2unix on them.
I have read that dos2unix works on Linux.
Is there a way that I can convert my files to having Unix newlines while working ...
34
votes
5
answers
146k
views
Carriage return and Line feed... Are both required in C#?
When inserting a new line character into a string I have usually done this:
str = "First line\nSecond line";
In C#, is this the standard practice? Should I also include the 'carriage return' ...
29
votes
4
answers
17k
views
How to get carriage return without line feed effect in Eclipse console?
If I
System.out.print("something\r");
at console, I have cursor back at the beginning of line, and finally after
System.out.print("something\r");
System.out.print(" any\r");
I have
anything
...
24
votes
3
answers
54k
views
convert new line /n to a line break in angular
I have a string which contain new line character /n. Trying to display
the string. Instead of taking the /n as new line, it displays '/n' as text.
$scope.myOutput = " Hello /n"
{{ myOutput |...
24
votes
1
answer
24k
views
Avoid writing carriage return '\r' when writing line feed with Python
If taken into consideration that carriage return = \r and line feed = \n
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "...
22
votes
5
answers
5k
views
PowerShell's pipe adds linefeed
I'm trying to pipe a string into a program's STDIN without any trailing linefeeds (unless that string itself actually ends in a linefeed). I tried googling around, but I only found people trying to ...
16
votes
2
answers
10k
views
How do I check if a character is a Unicode new-line character (not only ASCII) in Rust?
Every programming language has their own interpretation of \n and \r.
Unicode supports multiple characters that can represent a new line.
From the Rust reference:
A whitespace escape is one of ...
15
votes
4
answers
17k
views
Setting Java VM line.separator
Has anybody found a way how to specify the Java line.separator property on VM startup? I was thinking of something like this:
java -Dline.separator="\n"
But this doesn't interprete the "\n" as ...
14
votes
2
answers
32k
views
How can I use CSS to insert a line break after but not before an element?
For example:
HTML:
The quick brown fox <span class="break">{BREAK}</span> jumps over the lazy dog.
I want this to display:
The quick brown fox {BREAK}
jumps over the lazy dog.
...
14
votes
9
answers
27k
views
How to find out which line separator BufferedReader#readLine() used to split the line?
I am reading a file via the BufferedReader
String filename = ...
br = new BufferedReader( new FileInputStream(filename));
while (true) {
String s = br.readLine();
if (s == null) break;
...
}...
13
votes
3
answers
32k
views
How do you get Notepad++ to show separate lines when /r/n is in the text?
I've pasted some XML into Notepad++. The pasted text contains \r\n wherever a newline is supposed to occur. However, Notepad++ is just showing the entire file on a single line. It is as if it is ...
12
votes
7
answers
34k
views
Newline character omitted while reading from buffer
I've written the following code:
public class WriteToCharBuffer {
public static void main(String[] args) {
String text = "This is the data to write in buffer!\nThis is the second line\nThis is ...
12
votes
2
answers
11k
views
Change Line Feeds from CRLF to LF in Eclipse
I recently noticed that the line-feeds of files in my project are CRLF but I want them as LF.(I get the following message from GIT GUI :
"UTF-8 Unicode text, with CRLF line terminators"
How can I ...
12
votes
1
answer
5k
views
Serial port binary transfer changes carriage return
I have been trying to implement a primitive serial file transfer protocol in C this past week and I've come across a really weird problem which I can't seem to find the solution for online. I've ...
12
votes
2
answers
3k
views
Why does .gitattributes not override core.autocrlf configuration on Linux?
While setting up Git for a project, I've noticed that the line-ending normalization works a bit different on Linux and on Windows.
As I understand the Git documentation on this subject, the behavior ...
10
votes
4
answers
28k
views
css - multi line line-clamp (ellipsis) doesn't work
problem image
I applied this class to h3 tag.
.ellipsis-2 {
$lines: 2;
$line-multiple: 1.3;
$font-size: 1em;
display: block;
display: -webkit-box;
max-height: $font-size * $line-...
10
votes
3
answers
6k
views
What is a reverse line feed?
What I want to know is two points as below:
What is a reverse line feed?
What is the difference between reverse line feed and line feed?
Is there anyone can give me an example or make an explanation?...
9
votes
5
answers
70k
views
How do I remove line feed characters when selecting data from SQL Server?
I insert data that contains a line feed character into the database. Then I retrieve that data. I am using this script to attempt to remove the line feed while selecting the data from SQL:
Select ...
9
votes
3
answers
6k
views
How to avoid CRLF (Carriage Return and Line Feed) in Logback - CWE 117
I'm using Logback and I need to avoid CRLF(Carriage Return and Line Feed) when I log a user parameter.
I tried to add my class, which extends ClassicConverter, on the static map PatternLayout....
8
votes
3
answers
8k
views
\n and \r seem to work everywhere. Why is line.separator more portable?
I was just perusing through questions, and I found System.getProperty(line.separator) used in place of \n with the author's comment that the code was "portable". Reading through various forums, I've ...
6
votes
5
answers
3k
views
Preserving special chars in xml
I've an xml string stored in the db table with line feed characters.
In my C# 3.5 program, I load and manipulate it using Linq to xml and then show it as a string in the textbox control on the UI form....
6
votes
3
answers
200
views
How to break lines properly which contain both CJK and english characters in WordPress?
I found that CJK article in my wordpress4.7 can't break lines properly,which contain both CJK and english characters.
Here is the article before publish.
All the lines breaked properly before ...
5
votes
3
answers
21k
views
Java: How read a File line by line by ignoring "\n"
I'm trying to read a tab separated text file line per line. The lines are separated by using carriage return ("\r\n") and LineFeed (\"n") is allowed within in tab separated text fields.
Since I want ...
5
votes
0
answers
282
views
When piping a file in windows to a python script, my \r are deleting my characters
I have a file like this:
A\r
B\n
C\r\n.
(By \r I'm referring to CR, and \n is LF)
And this script:
import fileinput
for line in fileinput.input(mode='rU'):
print(line)
When I call python ...
4
votes
4
answers
1k
views
What is the point of using *both* Carriage Returns and Line Feeds?
I'd have thought one was enough. But what's the point of doing CRLF (0x0D0A), when you can simply use CR (0D)? Normally, whenever I'm using strings (C++), I do this:
myString = "Test\nThis should be ...
4
votes
3
answers
7k
views
"\n" being treated as a string literal in JavaScript
I have a select tag with an option tag that has a value of "\n". When that option is selected and I get the value using jQuery, JavaScript seems to be treating it as a string literal and not ...
4
votes
3
answers
45k
views
C++ Carriage return and line feed in a string
I am working with the communication for some TCP/IP connected equipment in C++.
The equipment requires that the commands sent are ended with \r\n.
I am using a configuration file from which I am ...
4
votes
4
answers
981
views
Accepting \r\n input C program
I would like to ask how can I accept \r\n without changing it to \\r\\n, with fgets.
I want the program to translate the \r\n to a newline character instead of printing it as a string.
Current code:
...
4
votes
2
answers
5k
views
\r\n vs \n\r what is the difference in their behavior? [duplicate]
I was referring to this question and understood that \n moves the cursor to next line without resetting it while \r resets the cursor but not move it to next line. And \r\n used as a new line char in ...