Questions tagged [newline]

Newline refers to a character sequence representing a line break in text (also known as End of Line, EOL, or Line Break). Different operating systems have different sequences for newlines.

Newline refers to a character sequence representing a line break in text (also known as End of Line, EOL, or Line Break). Different operating systems have different sequences for newlines.

5080 questions
2
votes
4 answers

bash: append newline when redirecting file

Here is how I read a file row by row: while read ROW do ... done < file I don't use the other syntax cat file | while read ROW do ... done because the pipe creates a subshell and makes me lose the environment variables. The problem arises if the…
Narcolessico
  • 1,921
  • 3
  • 19
  • 19
2
votes
1 answer

Visual Studio: Match Regex Across Varying Number of Newlines

Given the following HTML: I want to wipe out all tag2's in that HTML with one regex in Visual Studio. To match the first: \ To match the…
Chris Moschini
  • 36,764
  • 19
  • 160
  • 190
2
votes
1 answer

Why is there an extra new line character when I create a string using init(contentsOfFile:)?

I tried to read the contents of a file in my bundle and put it into a string variable. I used the init(contentsOfFile:) initializer. However, there always seems to be an extra \n character at the end of the string. Here is an MCVE: let string = try!…
Sweeper
  • 213,210
  • 22
  • 193
  • 313
2
votes
3 answers

JavaScript Heredoc? Escape Newline: JSLint Bad Escapement?

var wrapped_string = "shouldn't this\ work?" JSLint gives a bad escapement error. How do we do heredoc in JavaScript then? I have a long HTML string.
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
2
votes
2 answers

R equivalent for .NET's Environment.NewLine

Is there an R equivalent for Environment.NewLine in .NET? I'm looking for a character object that would represent a new line based on the environment, e.g. CR LF ("\r\n") on Windows and LF ("\n") on Unix. I couldn't find any such thing in the R…
Narvarth
  • 495
  • 4
  • 13
2
votes
3 answers

How to merge alternate lines to each following column?

I'm trying to merge alternate lines regarding each column input: ind1 T G T T T T ind2 G G T G T T desired Output: ind1 TT GT TT ind2 GG GT TT I tried these commands: sed 'N;s/\n/ /' output and paste - - output but…
Jontexas
  • 121
  • 8
2
votes
2 answers

Program can't find carriage return or newline. Returns out of range

I'm currently having an issue navigating a txt file so I can read it into an array. The program compiles fine, but when I run it returns in terminal: terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::erase:…
2
votes
1 answer

Removing line breaks from CSV exported from Google Sheets

I have some data in the format: -e, 's/,Chalk/,Cheese/g' -e, 's/,Black/,White/g' -e, 's/,Leave/,Remain/g' in a file data.csv. Using Gitbash, I use the file command to discover that this is ASCII text with CRLF terminators. If I also use the…
Peter Webster
  • 103
  • 11
2
votes
4 answers

Powershell Newline Character is not working I tried `n "`n" '`n'

**I tried n "n" '`n' Blockquote ** GC D:\code\ServerList.txt | % { $Comp = $_ #write-output "server Information" If (Test-Connection $Comp -Quiet){ $Luser = (Get-WmiObject -class win32_process -Filter "Name='Explorer.exe'" -ComputerName $Comp | %…
2
votes
1 answer

Cannot make newline character work in XSLT to Excel

I have an XSLT file to transform an XML to output XML containing Excel tags like Row, Cell, etc. The XSLT file has the below line: I need to display a multiline text in a single Excel cell,…
Rakesh
  • 43
  • 5
2
votes
0 answers

CKEditor removes CRLF

I'm using CKEditor 4.7. Some of my contents are HTML, some are Markdown. For Markdown, I would like to keep CRLF chars. Here is a text sample : This is the result in CKEditor, everything is on one line : In CKEditor code, I tried to print the…
emilie zawadzki
  • 2,035
  • 1
  • 18
  • 25
2
votes
2 answers

vim Comment Newlines Unexpected Behavior

In using vim, when I start a comment with //, immediately after I type a space, it begins a new comment line. For instance, if I typed the following: //hello world my name is stefan I would get: //hello //world //my //name //is //stefan This…
Stefan Mai
  • 23,367
  • 6
  • 55
  • 61
2
votes
2 answers

why is there a space after console logging with a backslash n?

The content after a new line character seems to start with an indent of one space. console.log('foo\n', 'bar'); This logs: foo bar Why isn't bar directly below foo? How would you log text starting at the same point of the line?
Gwater17
  • 2,018
  • 2
  • 19
  • 38
2
votes
2 answers

Finding pattern with newline using regex in Java 7

I am writing a regular expression being used to search through files and find the following pattern: {@link ClassName} provides * I have written this expression so far using java.util.regex.Pattern: private static final Pattern MY_PATTERN = …
petehallw
  • 1,014
  • 6
  • 21
  • 49
2
votes
3 answers

Removing newlines in Python

I have a sequence file begining with > and afterwards a lot of letters followed by newlines and then again >. I am able to extract the line begining with > and the letter lines in to two different variables, when there are no newlines, but I does…
user7579444