Create carriage-return in Notepad using replace

  • Thread starter Thread starter anthonyroh
  • Start date Start date
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.
 
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

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
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?
 
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

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
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
 
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
 
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:
 
Amazing! An exellent example of KISS (Keep It Simple Stupid). No downloads, no installs ....
just wit! Congrats!
 
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.
 
"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.
 
"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.
 
Back
Top