Questions tagged [end-of-line]

The end of a physical line

The end of a line is usually signaled by the '\n', '\r' or '\r\n' characters.

The line that has ended is the physical line, as is observed by the line-break in the visual text. This is different from the end of a logical line in programming languages, which is signaled by the ; character in many languages including the family of languages, , etc

134 questions
8
votes
1 answer

How to change the behavior of git status showing modified files which are eventually not committed?

I am working in a windows-only working environment with developers using all kinds of tools to edit their files. We are using .git along with the atlassian stack to version our code. I like almost all of it. I have just recently finished fighting a…
jhnwsk
  • 971
  • 12
  • 15
8
votes
1 answer

Viewing \n and \r characters in Vim?

Is there a way to make \n or \r characters visible in vim? (I want to be able to see if the csv file I am looking at uses just \n or \r and \n at the end of lines.
leeand00
  • 25,510
  • 39
  • 140
  • 297
7
votes
5 answers

Why is the start of a line "^" and the end of line "$"?

I never remember whether ^ matches the beginning of the line and $ matches the end of it or the other way around. A good mnemonic would be that the $ sign is always before the price, therefore it matches the beginning of a line - unfortunately it's…
laurent
  • 88,262
  • 77
  • 290
  • 428
6
votes
2 answers

Inserting endline into a stringstream

We know that when inserting \n in a file stream, the appropriate end-of-line sequence for the system will be written to the file (e.g. \r\n for Windows). Does inserting an endline in a std::stringstream result in the system-appropriate end-of-line…
Emile Cormier
  • 28,391
  • 15
  • 94
  • 122
6
votes
3 answers

How to read a 2d array from a file without knowing its length in C++?

Like the title says I'm trying to read an unknown number of integers from a file and place them in a 2d array. #include #include using namespace std; int main() { fstream f;int i,j,n,a[20][20];char…
NacRonDX
  • 63
  • 1
  • 9
6
votes
1 answer

Prevent EOL normalization for CSV files

I have a source repository that is used both from Windows and Linux. I know that Git will automatically convert EOL to the local standard: \r\n on Windows and \n on Linux. This is not an issue for source files. But I have some CSV files that use a…
Pragmateek
  • 13,174
  • 9
  • 74
  • 108
5
votes
4 answers

CSV End of line

Hi i am trying to put end of line code in CSV format to import it to excel I tried putting \n, "\n", \r, "\r", \r\n, "\r\n" but nothing worked for me I am trying to import it in excel 2013 my csv format is like below Medicine;1213;22;19\nMedicine…
sanu
  • 1,048
  • 3
  • 14
  • 28
5
votes
2 answers

.gitattributes don't work properly on mac and windows

On my project i use computers with different OS, one is Mac second is with windows. When I use git every change is shown as whole document change. The reason is different end-of-line in these two OS. I read this…
MaSza
  • 435
  • 7
  • 22
5
votes
6 answers

how to check end-of-line of a text file to see if it is unix or dos format?

I need to convert the text file to dos format (ending each line with 0x0d0x0a, rather than 0x0a only), if the file is in unix format (0x0a only at the end of each line). I know how to convert it (sed 's/$/^M/'), but don't how how to detect the…
Qiang Xu
  • 4,353
  • 8
  • 36
  • 45
5
votes
2 answers

Match end of line (EOL) with syntax match in vim

When I hit / in vim and search for $ it highlights all eols. But when I try to match them with syntax match it does not seem to work. function! ConcealNonText() set conceallevel=1 set concealcursor=v syntax match NonText /$/ conceal…
Saucier
  • 4,200
  • 1
  • 25
  • 46
5
votes
1 answer

In VIM, why don't you have to add back '$' in a search and replace?

I've been learning how to do more complex search and replace functions in VIM, and I ran across a use case like this: :%s/$/|/g This supposedly finds the end of every line and replaces it with a vertical pipe. When I was first learning this,…
asteri
  • 11,402
  • 13
  • 60
  • 84
4
votes
0 answers

GIT global config for ignore end-of-line white spaces

Even though I have not changed anything in one of file, I am getting one file in modified files list using > git status. When I saw that file using > git diff, it is displaying all lines are removed and all lines (same) are added, but when I use >…
Vishal Zanzrukia
  • 4,902
  • 4
  • 38
  • 82
4
votes
2 answers

Why does this parser always fail when the end-of-line sequence is CRLF?

This simple parser is expected to parse messages of the form key: value\r\nkey: value\r\n\r\nkey: value\r\nkey: value\r\n\r\n One EOL acts as a field separator, and double EOL acts as a message separator. It works perfectly fine when the EOL…
concept3d
  • 2,248
  • 12
  • 21
4
votes
3 answers

How to make Maven checking the source end-of-line?

I would like to enforce Unix style end-of-line (\n) in Java sources of our projects for consistency reasons. As many of us work under Windows, most IDEs are configured by default to use Windows style end-of-line (\r\n). We try to change that…
Florent Paillard
  • 549
  • 1
  • 6
  • 20
3
votes
1 answer

SQL Server - Bulk insert without losing CR or LF characters

I am trying to import email communication into a database table using Bulk Insert but I can't seem to be able to preserve the CR and LF characters. Let's consider the following: CREATE TABLE myTable ( Email_Id int, Email_subject varchar(200)…
alexstr
  • 35
  • 3
1
2
3
8 9