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

应用导航

UltraEdit feature maps
全新功能

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

节省将近50%

IDM Software Bundles

在UltraEdit基础上绑定其它的产品许可节省将近50%

旅行, 任何人?

UE3 software

UE3和您的UltraEdit捆绑一起升级,节省将近50%或者更多!


Take the UltraEdit tour