Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

README.md

Version: @(#) $Id: rmemptylines.md,v 1.5 2026/04/17 07:51:25 ralph Exp $

rmemptylines

Note

A smart Linux bash/shell utility to clean up text files cluttered with unnecessary blank lines, specifically designed to fix "double-spacing" caused by email clients like MS Outlook or over-enhanced MS Notepad garbling MarkDown.

🛠 Usage

rmemptylines [OPTIONS] <file>
Option Mode Description
-b Backup Creates a .bak copy of the original file before processing.
-x Auto (Default) Analyzes the file and automatically fixes Outlook-style double-spacing if detected.
-s Squeeze Collapses multiple consecutive blank lines into a single one.
-d Double Removes every even-numbered line only if it is empty (precise Outlook fix).
-a All Aggressive mode: Removes every single blank line, leaving no vertical space.
-m MarkDown Markdown cleanup, fixes MS Notepad escapes: &#x20;, \-, \#, etc. Thx MS!

💡 Examples

Clean up a MS Markdown file and create a backup before:

rmemptylines -m -b notes.md

Fix a broken Outlook copy-paste (Auto-detect):

rmemptylines my_report.txt

Strip every blank line and squeeze remaining gaps:

rmemptylines -a -s config.conf

Reduce large gaps to single spaces:

rmemptylines -s messy_notes.log

⚠️ Important Notes

Warning

  • In-place Editing: The tool overwrites the target file directly. Ensure you use the -b flag if the data is critical.
  • Stacking Modes: You can combine multiple flags (e.g., -m -s) to perform successive cleanups in one command.
  • Pre-cleaning: The script automatically strips invisible trailing whitespace and tabs from lines before processing to ensure "empty" lines are correctly identified.
  • Line Endings: Uses flip (flip 1.20-5) to ensure the final file has consistent Unix-style line endings. You also can use dos2unix if your OS does not provide flip.

// END of document //

About

A smart Linux bash/shell utility to clean up text files cluttered with unnecessary blank lines, specifically designed to fix "double-spacing" caused by email clients like MS Outlook or over-enhanced MS Notepad garbling MarkDown.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages