Remove spaces at the end of line

25 06 2010

Recently someone asked me to apply formatting to a document. I copied the content to a new document in OpenOffice Writer (without the original formatting). The original document was created with MS Word and contained trailing spaces at the end of almost each line. The document had over 20 pages so it would take pretty much time to get rid of them manually. There’s a simpler method.

Delete all spaces in few clicks

  1. In OpenOffice Writer click Edit > Find & Replace (or press CTRL+F).
  2. Click More Options. The dialog should extend with additional settings.
  3. Select Regular expressions.
  4. In the field Search for enter:' $'

    (space and dollar sign without quotes).

  5. Make sure that Replace with is empty (no characters including whitespaces).
  6. Click Replace All.
  7. Done.

More reading

Information concerning regular expressions in OpenOffice Writer.