I need help with find and replace [returns at the end of every line]

hi folks, I’m brand new to using libre office. I receive word docs from a dictation service that uses an old version of Word. I would have to open in text edit, then copy/paste to a new word doc. libreoffice was recommended to me to be able to open and edit them. the docs come formatted with returns at the end of every line, like they were typed on and old typewriter. this make editing very difficult. before using office libre, I would edit by using find and replace to get rid of the returns at the end of the lines. the symbol for return in word is ^p, but that does not work in libre. what is the symbol for the return in libre to replace it with a space? thank you!

You can’t do that in Writer because there is no “object” like a paragraph mark. Find & Replace change feature is limited to the contents of a paragraph. The paragraph delimiter is outside this contents.

It seems you have received a TXT file, i.e. a non-formatted plain text. If it has no .txt extension (in its filename), save it as such with Writer. Then, use TextEdit (you’re under MacOS, aren’t you) to remove all line breaks and “reconstruct” the paragraph structure by inserting line breaks at end of paragraphs. Once done, open it with Writer, do your editing and styling. In the end, save as .odt for further work on it and, optionally, save a copy as .doc or .docx for your external recipients.

For stability and integrity of your document, work only on the .odt version to avoid the repetitive conversion ot/from alien format which damages the document by its cumulative effect.

PS: when asking here, always mention OS name, exact LO version and save format.

You can use Find & Replace (Ctrl+H)

  1. In Find enter the mark for the end of a paragraph, $
  2. In Replace enter a space
  3. Expand Other options and tick Regular Expressions
  4. Tick Current Selection if you want to limit it to just a portion of the text
  5. Click Replace All

Note: if they are line breaks, not paragraph breaks, then in Find enter \n instead

See Using Regular Expressions in Text Searches and List of Regular Expressions

If indeed you are on a Mac, I’m not, you have access to the command line, I think Mac calls it ‘Command’. Can’t swear to it but likely from the command line you have access to the ‘tr’ command.
tr “\n” “\r” oldfile > newfile
might save you a lot of time.
\n = new line aka linefeed
\r = return aka carriage return
For line endings in text Dos/Windows uses '\r\n", Mac uses “\r”, Unix/Linux uses “\n”.
Should you end up with double spaces due to converting “\r\n” to “\r\r” then just delete the “\n” with
tr -d “\n” oldFile > newFile.
No guarantees since I don’t have a Mac but Brother does and I have to translate files to/from him occasionally.
Should it happen that your old file has really long lines separated by a paragraph character of some sort the fold command might be of use:

fold (1)             - wrap each input line to fit in specified width
SYNOPSIS
       fold [OPTION]... [FILE]...
       -s, --spaces
              break at spaces
       -w, --width=WIDTH
              use WIDTH columns instead of 80

Best of luck,
Mike
If

you can install AltSearch : https://extensions.libreoffice.org/en/extensions/show/70066

1 Like

thank you for the suggestions. yes I’m on a Mac. I’m not familiar with some of the symbols and terms offered above (tr -d \n…), but can have a friend walk me through them.