Create carriage-return in Notepad using replace

A

anthonyroh

Can anyone tell me how to create carriage returns in a Notepad
document? Using from the Edit Menu, Replace? for example, for every
comma it detects a carriage return on the comma.
 
G

Graham Mayor

There is no 'carriage' to return in a word processor. Pressing the enter key
(^p in the replace dialog) creates a new paragraph. Shift enter (^l) creates
a new line within a paragraph.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
A

anthonyroh

Hey Graham,
Thanks, I realized I put this into the wrong group. I am trying to
make a script easier to read using Notepad. I know there is a command
out there using the Edit\Replace to substitute commas with a carriage
return to make everything with a comma on a new line.

Sorry if I was confusing, but thanks for responding. Any thoughts
using Notepad?
 
G

Graham Mayor

You'll need to use a more capable text editor, such as Word or maybe
UltraEdit.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Joined
Jun 23, 2009
Messages
1
Reaction score
0
This can be done in Notepad (for CSV files)

You can search and replace by CR in Notepad (works for CSV purposes) by:

- Firing up Excel, and typing Alt-Enter in a cell to enter a CR
- Saving this file as CSV
- Opening this CSV in Notepad - the CR will be shown as a blank square
- Copy this square and paste it into Replace
- When replace is done, CR will be there, and can be interpreted (though not with Notepad - but Wordpad will do it, so will Excel...)

Petar
 
Joined
Oct 27, 2011
Messages
1
Reaction score
0
There are a couple of solutions. This requires a text editor with more features than Notepad, preferably "regular expressions".
1) Get a free download of Notepad++. After pasting your text into a new file window, select Search / Replace from the menu. Put a comma in the "Find what:" box, and the following in the "Replace with:" box: \n

NOTE: You must select the radio button at the bottom left of the replace popup for "Regular expression". The above will execute a regular expression to replace all commas with a carriage return.

2) The same thing can be done with Edit Pad Pro, Ultraedit, etc. Another idea is to view the file in hexadecimal code (Editpad Pro should be able to do this), do a find for the hex value of a comma (2C), and do a "replace all" with the hex value of a carriage return (0D).

Greg Burdett
 
Joined
Jun 15, 2013
Messages
1
Reaction score
3
Can anyone tell me how to create carriage returns in a Notepad
document? Using from the Edit Menu, Replace? for example, for every
comma it detects a carriage return on the comma.
Hey Tony,
You may do the following to get it the way you want.
Replace " , " with " <br> " and then, save as with an " .html " extension.
Open the html file in the browser, You'll get it the way you want. Copy the text from there, and paste it back to the notepad, saving it as a text file. :thumb:
 
Joined
Jul 27, 2015
Messages
1
Reaction score
0
Amazing! An exellent example of KISS (Keep It Simple Stupid). No downloads, no installs ....
just wit! Congrats!
 
Joined
Oct 10, 2021
Messages
1
Reaction score
0
Hey Tony,
You may do the following to get it the way you want.
Replace " , " with " <br> " and then, save as with an " .html " extension.
Open the html file in the browser, You'll get it the way you want. Copy the text from there, and paste it back to the notepad, saving it as a text file. :thumb:
This is so good, just good ol' Notepad and a browser. I actually just used this to create a working m3u8 manifest out of an xhr page littered with the \n escape sequence, really didn't feel like writing a script.
 
Joined
Apr 1, 2022
Messages
2
Reaction score
0
"There is no 'carriage' to return in a word processor."

Wrong! Google "carriage return key on computer" and you will see that there are plenty of "Returns" and the down/left arrows on keyboards. Plus without a carriage return, everything in a document would be on the same line.
When you press it, it drops you down one line and moves you to the first position on the next line and does the exact same function as he mechanism that was found on typewriters.

You would think a "Word MVP" would know that... Graham!

Plus the <br> trick didn't work either.
 
Joined
Apr 1, 2022
Messages
2
Reaction score
0
"There is no 'carriage' to return in a word processor."

Wrong! Google "carriage return key on computer" and you will see that there are plenty of "Returns" and the down/left arrows on keyboards. Plus without a carriage return, everything in a document would be on the same line.
When you press it, it drops you down one line and moves you to the first position on the next line and does the exact same function as he mechanism that was found on typewriters.

You would think a "Word MVP" would know that... Graham!

Plus the <br> trick didn't work either.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top