Replace Carriage return with empty

zhshqzyc
zhshqzyc used Ask the Experts™
on
I have a lot Carriage return in a file, how to replace them with empty quickly?
Now I delete them manually.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2011
Commented:
Find: ^p
Replace:

See if this works for you.
GrahamSkanRetired
Top Expert 2012

Commented:
Have you tried Find and Replace?

Find: ^p
Replace:     (space or nothing)
Top Expert 2011

Commented:
Replace above is essentially blank.
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

GrahamSkanRetired
Top Expert 2012

Commented:
Ctrl+H opens the 'Find and Replace' dialogue.
GrahamSkanRetired
Top Expert 2012

Commented:
When a text file is opened in Word carriage returns are treated as paragraph markers. Hence ^p. ^ means a special character is next and p means that it is the end of a paragraph.

Note that line feeds are represented by ^l (carat + lowercase L), which might look the same in your document.

Author

Commented:
My case is a little complex. Please see the attached samples.
VBA needed?

Points are increased to 500.
WWOX.doc
wwox
Retired
Top Expert 2012
Commented:
Not quite clear what you acryall nee, but try


Find: :^p

Replace: ^t

This replaces acolon, followed by a paragraph marker with a tab character
GrahamSkanRetired
Top Expert 2012

Commented:
Oops.  For  "acryall nee", read "actually need". Thank you.

Author

Commented:
I will come back to explain a little bit.
Unfortunately, the WWOX.doc (input) and wwox.txt (output) do not contain the same text.

I opened WWOX.doc and noticed NO extra carriage returns, however, there is space between the paragraphs:

WWOX (c/r)

76706436/P98L: (c/r)

atggggttttcctaaagtataagattgtcttatatttataaatgcctgtgttcattgctgtgggttcactgctttctcttttgggcagCCATATAAATAAAAGAACCACCTACTTGGACCCAAGACTGGCGTTTACTGTGGATGATAATC[C/T]GACCAAGCCAACCACCCGGCAAAGATACGACGGCAGCACCACTGCCATGGAAATTCTCCAGGGCCGGGATTTCACTGGCAAAGTGGTTGTGGTCACTGGAGCTAATTCAGGAATAGgtaggctcttcacttagttatttatctttgggac (c/r)

76706501/R120W: (c/r)

tcactgctttctcttttgggcagCCATATAAATAAAAGAACCACCTACTTGGACCCAAGACTGGCGTTTACTGTGGATGATAATCCGACCAAGCCAACCACCCGGCAAAGATACGACGGCAGCACCACTGCCATGGAAATTCTCCAGGGC[C/T]GGGATTTCACTGGCAAAGTGGTTGTGGTCACTGGAGCTAATTCAGGAATAGgtaggctcttcacttagttatttatctttgggactgctataatgagatccacttagatctagctataatggaattttgtttagtggttctctgatttaa (c/r)

(c/r)

I noted also that the space AFTER each paragraph (i.e. each (c/r)) is 10 points...

If you remove all the (c/r)'s in the document, as explained in most of the above answers, you get the following text:

WWOX 76706436/P98L: atggggttttcctaaagtataagattgtcttatatttataaatgcctgtgttcattgctgtgggttcactgctttctcttttgggcagCCATATAAATAAAAGAACCACCTACTTGGACCCAAGACTGGCGTTTACTGTGGATGATAATC[C/T]GACCAAGCCAACCACCCGGCAAAGATACGACGGCAGCACCACTGCCATGGAAATTCTCCAGGGCCGGGATTTCACTGGCAAAGTGGTTGTGGTCACTGGAGCTAATTCAGGAATAGgtaggctcttcacttagttatttatctttgggac 76706501/R120W: tcactgctttctcttttgggcagCCATATAAATAAAAGAACCACCTACTTGGACCCAAGACTGGCGTTTACTGTGGATGATAATCCGACCAAGCCAACCACCCGGCAAAGATACGACGGCAGCACCACTGCCATGGAAATTCTCCAGGGC[C/T]GGGATTTCACTGGCAAAGTGGTTGTGGTCACTGGAGCTAATTCAGGAATAGgtaggctcttcacttagttatttatctttgggactgctataatgagatccacttagatctagctataatggaattttgtttagtggttctctgatttaa  

Author

Commented:
Maybe manually do it is fast.
Firstly: I want to remove
WWOX

Open in new window

because it is underlined.
Secondly I want to remove : or in other words replace : with a tab
Thirdly: the format likes
[title][tab][agcttgca...][c/r]
[title][tab][agcttgca...][c/r]
[title][tab][agcttgca...][c/r]

Open in new window

title likes
76706436/P98L

Open in new window


Another test file is attached.
test.doc
GrahamSkanRetired
Top Expert 2012

Commented:
This is changing from a simple question to a project.

Also it's not easy to understand what you are trying to do.

You have some underlined paragraphs with text beginning 'TITLE'. After that you have some other paragraphs, alternating between short paragraphs, ending with a colon, and longer paragraphs which don't. There is also an empty paragraph after this set.

Assuming that you have taken our previous advice on board, can you now please explain where you are having problems?

Author

Commented:
The previous advice is helpful. But it removed all carriage return. What I want is to keep one carriage return between short paragraphs.

I used replace all to cause the issue. Probably I have to replace one by one.
Original question (ID: 27037232, Author: zhshqzyc): I have a lot Carriage return in a file, how to replace them with empty quickly?
Now I delete them manually.


I agree - esentially, the question (ID: 35757264, Author: zhshqzyc) has nothing to do with replacing carriage returns.
If you look at the test.doc file, you are trying to insert new paragraphs at what seems random places in your document. This can only be done manually.

Author

Commented:
Okay. Never mind. Thanks for help. Point splited.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial