Saturday, 19 July 2008

Removing all blank lines from a file with regular expressions in Visual Studio or UltraEdit

I often deal with files which have redundant empty lines in them. These are easily removed by either Visual Studio or one of the best text editors around, UltraEdit by IDM Solutions. The regular expression criteria matching blank lines in these 2 applications are slightly different (the end of line escape character "$" appears in a different order in each):

Visual Studio:

Press Ctrl+G
Select "Use Regular Expressions"
In Find specify "^$\n" (without the quotes).
Set the replace value to blank.
Click on "Replace All"

UltraEdit:

[from the UltraEdit FAQ at at http://www.ultraedit.com/support/faq.html]

To delete/strip blank lines from DOS/Unix/Mac formatted-files, use the following Perl-compatible regular expression. 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).

Earlier versions of UltraEdit:

To delete blank lines with DOS line terminators you can use an UltraEdit-style regular expression replace as follows:

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

Run this replace until every blank line is deleted.

9 comments:

Pedro Garcia Inácio said...

Thanks a lot! :-)

Dean said...

thank you, FYI, this works in Sharepoint Designer also

tinycrack.com said...

idm test edditer

Serialsofts.com said...

Thanks for sharing this awesome tips. IDM UltraEdit 26.20.0.68 Crack

Licenselinks. said...

So nice I am enjoying for that post as for u latest version of this Security tool Available…MiniTool Partition Wizard Technician Crack 12 With Serial Key Latest 2020

plugin-torrent.com said...

THANKS FOR SHARING YOUR KNOWLEDGE TO INSTALL & CRACK THE ASC TIMETABLES, BUT YOU NEED TO UPDATE IT NOW BECAUSE THERE IS A 2020 VERSION AVAILABLE NOW: YOU CAN GET IT HERE:TRAKTOR PRO 3 FOR MAC FREE DOWNLOAD 2020

Muzamil Ansari crack said...

Quality posts are important to invite visitors to your site, that's it
this website offers.
blufftiler ultimate crack
ytd video download pro crack
bandicam crack
vero machining strategist crack

Korg Legacy said...



Voicemod Pro Crack
I am very impressed with your post because this post is very beneficial for me and provide a new knowledge to me

Samuel Badree said...

You have to check thi web i like this web
Mobile Prices Bangladesh