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
100
votes
8 answers

How to convert Windows end of line in Unix end of line (CR/LF to LF)

I'm a Java developer and I'm using Ubuntu to develop. The project was created in Windows with Eclipse and it's using the Windows-1252 encoding. To convert to UTF-8 I've used the recode program: find Web -iname \*.java | xargs recode…
MaikoID
  • 1,001
  • 2
  • 8
  • 4
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
68
votes
12 answers

Remove end of line characters from Java string

I have string like this "hello java book" I want remove \r and \n from String(hello\r\njava\r\nbook). I want the result to be "hellojavabook". How can I do this?
sahil
40
votes
5 answers

SourceTree App says uncommitted changes even for newly-cloned repository - what could be wrong?

A remote git repository is just cloned to a local box using Atlassian SourceTree. Even no files have really been modified in the work tree, Atlassian lists a bunch of files right away under "Uncommitted changes". Each file shows same line count both…
Ville Mattila
  • 1,343
  • 3
  • 15
  • 28
36
votes
6 answers

Javascript: Convert textarea into an array

How would you go about breaking up a textarea value into an array, based on the end of line separation? Use of jQuery is cool by me...
Matrym
  • 16,643
  • 33
  • 95
  • 140
29
votes
4 answers

Vim no end of line on last line or eof

I am trying to setup vim to skip adding eol on last line or eof, i have tried this :set binary :set noeol :w which is not perfect cause binary override filetype for later use. Any other option to set this, i don't need newline on last line.
20
votes
5 answers

Portable end of line

is there any way to automatically use correct EOL character depending on the OS used? I was thinking of something like std::eol? I know that it is very easy to use preprocessor directives but curious if that is already available. What I am…
Andrew
  • 2,309
  • 4
  • 27
  • 42
19
votes
2 answers

How to configure GNU Emacs to write UNIX or DOS formatted files by default?

I've had these functions in my .emacs.el file for years: (defun dos2unix () "Convert a DOS formatted text buffer to UNIX format" (interactive) (set-buffer-file-coding-system 'undecided-unix nil)) (defun unix2dos () "Convert a UNIX formatted…
Greg Mattes
  • 33,090
  • 15
  • 73
  • 105
18
votes
7 answers

MySQL LOAD DATA INFILE: works, but unpredictable line terminator

MySQL has a nice CSV import function LOAD DATA INFILE. I have a large dataset that needs to be imported from CSV on a regular basis, so this feature is exactly what I need. I've got a working script that imports my data perfectly. .....except.... I…
SDC
  • 14,192
  • 2
  • 35
  • 48
17
votes
2 answers

NSAttributedString '\n' ignored

I have a single view whose only UI element is a UITextView. In viewDidLoad: I create an attributed string with "Text\n" and set the text view's attributed text as such: NSAttributedString *string = [[NSAttributedString alloc]…
winsome
  • 173
  • 1
  • 6
16
votes
2 answers

Python readline with custom delimiter

novice here. I am trying to read lines from a file, however a single line in a .txt file has a \n in the middle somewhere and while trying to read that line with .readline python cuts it in the middle and outputs as two lines. when I copy and past…
hgv
  • 227
  • 1
  • 2
  • 5
15
votes
4 answers

String continuation across multiple lines, no newline characters

Am using the RODBC library to bring data into R. I have a long query that I want to pass a variable to, much like this SO user. Problem is that R interprets the whitespace/carriage returns in my query as a newline '\n'. The accepted solution for…
Andrew
  • 9,090
  • 8
  • 46
  • 59
13
votes
8 answers

How to remove ^M

How can I remove the ^M character from a text file (at the end of line) in a Python script? I did the following, and there are ^M at every line-break. file = open(filename, "w") file.write(something)
DGT
  • 2,604
  • 13
  • 41
  • 60
13
votes
7 answers

Convert all EOL (dos->unix) of all files in a directory and sub-directories recursively without dos2unix

How do I convert all EOL (dos->unix) of all files in a directory and sub-directories recursively without dos2unix? (I do not have it and cannot install it.) Is there a way to do it using tr -d '\r' and pipes? If so, how?
user1316233
  • 161
  • 2
  • 2
  • 4
8
votes
1 answer

Prettier --write replaces LF by CRLF on Windows

Some members of my team use Mac, some use Linux and other use Windows. We started to use prettier --write before pushing changes to ensure uniformity in code style. The problem occurs on Windows, where all project files are changed. Prettier…
Leo Lobeto
  • 364
  • 3
  • 14
1
2 3
8 9