Home  »  Support  »  Tutorials/Power Tips  »  UltraEdit  »  Remove blank lines
IDM Power Tips

Remove blank lines

A question which is frequently asked is "I have a lot of blank lines in my file and I don't want to go through and manually delete them. Is there an easier way to do this?"

The answer: YES!

In versions of UltraEdit that support Perl-compatible regular expressions, you can use the following Perl-compatible regular expression in DOS/Unix/Mac formatted-files. You can enable Perl-compatible regular expressions under Advanced -> Configuration -> Search -> Regular Expression engine.

Replace: "^\r?\n?$" (without the quotes)
With "" (without the quotes - i.e. nothing).

In previous versions of UltraEdit, to delete blank lines you can use a regular expression replace as follows: Find What: "^p$" (without the quotes)
Replace With: "" (without the quotes - i.e. nothing).


Removing Blank lines


Step 1: Determine the file(s) that contain blank lines


Step 2: Open the Replace dialog

You may open the replace dialog using the shortcut (CTRL + R) or by going to the search menu and clicking on "Replace".

To delete blank lines you can use a regular expression replace as follows:

Find What: "^p$" (without the quotes)
Replace With: "" (without the quotes - i.e. nothing).

Note: You MUST select "Regular Expressions." Also, "UltraEdit style expressions" must be selected under Advanced -> Configuration -> Search -> Regular Expression Engine.

Depending on your circumstances, the "Replace Where" option you select may vary.


Step 3: Your blank lines are gone!

Please note, you may have to run the "Replace All" multiple times to ensure all blank lines are removed. Because of the way the regular expression works, the replace will not replace all blank lines that are grouped together.


Back to power tips index


Buy Now
Upgrade
Download

Get your solution today!

UE/UC

Add UltraCompare to your purchase/upgrade of UltraEdit and complete your file management solution.


"We won't mince words:
UltraEdit is outstanding..."

Application Screenshots

Feature maps

Road trip, anyone?

UE Mobile

Bundle UE Mobile with your UE upgrade and save 50%!


Take the UltraEdit tour