Removing Carriage Returns with the Find/Replace command

Is there a way of using the Find/Replace command to remove the carriage returns to reformat plain text? As in the way ^p is used in Word - tried a few of the other usual formats, but no luck so far.

Dave.

You can do this by pulling down Format>Show Invisible Characters. Double click on one of the return characters, copy and paste it into the find/replace dialog (Don’t worry when it doesn’t appear in the dialog’s find field.)

As an alternative you can install DT’s Word Services and use one of the Format routines.

  1. Select All of the text you want to format.
  2. Go to the Services menu, chose Format: Reformat.
  3. After using it once, the keyboard Cmd-& will reformat selected text.
  4. Other text-editing commands are available under the Reformat menu.

If you don’t see this Services menu, you need to install the free Services software available at

devon-technologies.com/download/index.html

Thanks for the quick reply. Dropped in Word Services and it works a treat. Very nice indeed.

Dave.

Yes, I’d like to be able to do that, as well as replace multiple spaces with a tab.

For instance, say I have an rtf file with several instances of:
[color=darkblue]carriage return
space-space-(#).-space-space
and I’d like to add a carriage return and convert the spaces to tabs, leaving the number intact. What I’ve done in the past, as suggested by tvillemw, is copied the first group prior to the number and pasted it into the Find window. Then I changed the text to what I want and used copy and paste to get that into the Replace window. I repeat this for the spaces following the number to change those to tabs.

It thought I’d test this just now and try using a wildcard (?) to replace the number so I could do it all in one shot. But it seems I’m having trouble with my Find text disappearing from the box when I tab to the Replace box. Hmm.

Mark

OS X (10.3.9)
DTpro 1.1

The Find text is probably still there but not (completely) visible due to the carriage returns/line feeds. However, wildcards are not (yet) supported by Find/Replace.

What I’ve been looking for is a quick way to do reformatting of large multi-para text files. In Word I select the entire document, Find ^p^p to get the paras, Replace that with %%%%, Find ^p, Replace with to remove the individual hard line returns, Find %%%% and Replace with ^p^p to return the paragraphing. Takes a few seconds to do a 20 pager.

DT will replace the returns - all of them, doesn’t seem to recognise the doubles alone - but will not replace the %%%% with a carriage return copied from another file. Just beeps every time. Word Service works fine for single paras, but for large docs I’ve found it easier to open Word, past the text in, do the conversion and paste it back over the original in DT. Not much of a drama as I usually convert before I import them anyway, but there are a few that got in unconverted.

Dave.

The next version of WordService will include improved reformatting of rich texts - works fine over here (as long as the selection does not contain tables).

Dave, I was able to make all the changes you mentioned via the Find/Replace dialog. The problem is that Apple’s routines (not DT’s) for displaying text implement the carriage returns in the dialog box. Perhaps, when you pasted the returns, it only added to what was already there (and hidden from you). If you want to make sure you get the right number of returns, press cmd-A in the input box and paste the returns over the highlighting, if that makes sense. It’s really awkward, I know, you are probably better off reformatting before importing.