主页  »  技术支持  »  指南/使用技巧  »  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

Cnet/Download.com review
"我们并没有夸大其词:
UltraEdit真的非常棒..."

Corporate Licensing

It's easy to purchase corporate licensing from us!

  • Bulk/quantity discounts
  • Enterprise/plant/site licensing
  • Purchase with PO or invoice

The new UltraSuite

The only fully integrated solution of its kind!

Four powerful applications: UltraEdit, UltraCompare, UltraFinder, and UltraSentry!

Save over 33% when you bundle with the UltraSuite!

Power of Portable

Now supporting PortableApps!

UE/UC Mobile

Unleash the power of the total file management solution on your flash drive!