The most basic way to get rid of extraneous spaces from text documents is to scan for them line by line and remove each one with your Delete key, but this can become quite tedious work. If you are using a text editor like TextPad, however, you can remove unneeded spacing instantly using the application's built-in Replace tool. The Replace tool can also remove all blank or empty lines from your document.
Remove Space Character
Click the "Search" menu and choose "Replace." Alternatively, you can click the "Replace" button on the tool bar.
Click within the input box labeled "Find what" and then press your space bar once. Leave the "Replace with" input box empty.
Select the "Active document" radio button so that TextPad removes the space characters in the current document only.
Click "Replace All" to command TextPad to search for each space character in your document and remove it without putting anything else in its place. Each line of your document should be condensed and free of empty spaces.
Type "\t" in the "Find what" input box. TextPad and Windows interpret "\t" internally as the code signaling a tab indention, rather than the literal character string "\t."
Select the "Text" and "Active document" radio buttons.
Check the box labeled "Regular expressions." When "Regular expressions" is selected, TextPad will scour through your document for the internal codes rather than literal characters. When it finds the internal code for "\t", it will delete the preset number of spaces that each tab represents.
Click "Replace All" to remove all tabs from your text document.
Remove Empty Lines
Type "\n" in the "Find what" input box. The "\n" characters internally signals the end of the current text line and the beginning of the next line in your document. The "\n" character sequence is also known as the "newline" or "end-of-line" code.
Check the box labeled "Regular expressions." TextPad will scan your entire document for the newline code.
Click "Replace All" to remove all blank lines from your document. All the text in your document will then be displayed as a single line.
Save even more time by creating a TextPad macro to sequentially remove all single spaces and tabs in your documents with a single command. Open a document containing spaces and tabs. Click the "Macro" menu and then "Record." First, go through the steps necessary to remove spaces and then the steps to remove tabs. Press the "Record On/Off" button to stop the macro from recording. Click "Yes" to save the macro, fill in the "Save Macro" dialog box information and then click "OK." To run this tool on another document, click "Macro" and then the name of the macro you created.
Information in this article applies to TextPad 7.4. It may vary slightly or significantly with other versions of TextPad.