Questions tagged [newlines]
140 questions
75
votes
9 answers
How do I convert a bash array variable to a string delimited with newlines?
I want to write out a bash array variable to a file, with each element on a new line. I could do this with a for loop, but is there another (cleaner) way to join the elements with \n?
ACyclic
- 923
- 1
- 7
- 9
46
votes
14 answers
Convert Unix line endings to Windows
I recently moved back to Windows from Linux. I have some files with CRLFs, some with LFs and some that are mixed. Is there a utility that will help me find all my Unix-touched files and convert them to proper CRLF terminated files?
The utility must…
Matthew Scouten
- 1,843
- 3
- 18
- 21
38
votes
1 answer
Did Mac OS Lion switch to using line feeds (LF '\n') for line breaks instead of carriage returns (CR '\r')?
I switched to Lion a while back and just noticed that when I save a text file in TextEdit, it uses LF for line breaks. I looked around everywhere I could think of on my Lion computer and could not find any evidence of files using CR for line breaks…
Matt
- 847
- 2
- 11
- 24
38
votes
7 answers
How can I insert a new line in a cmd.exe command?
I'm trying to execute a command on cmd.exe, with a line break or new line as part of the command, like below:
command -option:text
whatever
But every new line executes the command, instead of continuing the command on the next line.
So how can I…
rudimenter
- 481
- 1
- 4
- 4
36
votes
3 answers
Vim: show line feeds & carriage-return
How can I display line feeds and/or carriage-return characters in vi/vim?
I know that set list shows all the whitespace characters (?), it also replaces tabs \t etc (but that's not what I want). Basically I just want to display certain characters…
watain
- 641
- 1
- 6
- 15
31
votes
4 answers
How are \n and \r handled differently on Linux and Windows?
I think \n moves the needle down, and \r moves the needle to the beginning of a line (left align)? I'm not sure, though. So, if I'm wrong please correct me....
Anyway, I was told that Windows and Linux handle newlines and carriage returns…
千里ちゃん
- 421
- 1
- 4
- 5
29
votes
5 answers
Replace newline character with another in Word 2007
Using Microsoft Word 2007, is it possible to replace the newline character (\n) with some other character?
What about vice versa? (That is replace a character with the newline character).
amir joudaki
28
votes
5 answers
Why is Vim adding a newline? Is this a convention?
If I open Vim and type itest:wq then I get a file that has no newlines in Vim but does seem to have a newline in the code:
$ vim -u NONE test.txt
$ cat test.txt | hd
00000000 74 65 73 74 0a |test.|
00000005
If I open Vim…
dotancohen
- 11,278
- 19
- 67
- 96
24
votes
1 answer
How can I use newline with the Find-And-Replace in Visual Studio?
I've become rather fond of the "Find-And-Replace" function in Visual Studio. The function lets me replace phrases, words, symbols, or whatever you can type into the textbox on the screen.
How can I make it replace a character with a newline?
Vivian River
- 495
- 1
- 6
- 18
23
votes
2 answers
How do I interactively type \r\n-terminated query in netcat?
$ nc example.com 80
GET / HTTP/1.1
Host: example.com
HTTP/1.1 200 OK
...
It works, line separator is just 0A here instead of required 0D0A.
How do I type a 0D0A-separated query in netcat?
It is easy to do one-time thing with printf manually…
Vi.
- 16,755
- 32
- 111
- 189
23
votes
5 answers
Copy multiple lines from Windows Command prompt without forced newlines
Is it possible to copy multiple lines from the Windows Command Prompt without it inserting a new line where each line reaches the end of the terminal?
For example, if I have the following line in the…
Adam Millerchip
- 1,536
- 1
- 11
- 15
23
votes
2 answers
What is the magic separator between filenames in ls output?
The output of ls (with no arguments) appears to separate filenames with linebreaks.
Evidence:
ls | grep foo works as expected, with grep treating each filename as a separate line of input.
ls > files.txt; vim files.txt --> in Vim, each file is on a…
Chris B
- 333
- 2
- 6
22
votes
9 answers
Is there a Bash command to convert \r\n to \n?
Is there a Bash command to convert \r\n to \n?
When I upload my scripts from Windows to Linux, I need a utility like this to make things work.
user25321
- 361
- 2
- 3
- 4
18
votes
3 answers
How to print new line character with echo?
I dump a string with hexdump like this 2031 3334 2e30 0a32 2032 3331 302e 000a. It is clear that 0x0a is new line character, however, when I try to echo this string out, I always got 1 430.2 2 13.0 -- the new line is replaced with a space, even I…
Summer_More_More_Tea
- 983
- 6
- 14
- 28
16
votes
6 answers
Notepad++ Delete Lines with Find & Replace
Does anyone know how to delete a line using Find & Replace in Notepad++ ?
In my Find query it finds the proper lines okay: ^.pPrev.$
In the Replace field, I leave it blank thinking the line should deleted (i.e. replaced with nothing), but the…
Jim Fell
- 5,836
- 16
- 55
- 76