Delete ALL Empty Lines In PHP File

Post your questions and problem reports here

Moderator: kfury77

Forum rules
Please try to follow these guidelines. This will help to receive faster and more accurate response.
  • Check the Support section of the corresponding product first. Chances are you will find your answer there;
  • Do not create new topics for already reported problems. Add your comments to the existing topics instead;
  • Create separate topic for each problem request. Do NOT post a number of non-related problem reports in a single topic;
  • Give your topic a meaningful title. Titles such as "A question," "Bug report" and "Help!" provide others no clue what your message is about;
  • Include the version number of the software you are using;
  • This is not an official customer support helpdesk. If you need a prompt and official response, please contact our support team directly instead. It may take a while until you receive a reply in the forum;
Post Reply
energylevels
Posts: 36
Joined: Sat Feb 21, 2015 1:50 am

Delete ALL Empty Lines In PHP File

Post by energylevels »

I need to delete all empty lines on a PHP file, hot to do this with find a replace or other method?

thanks
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: Delete ALL Empty Lines In PHP File

Post by Aivars »

You can either use Search & Replace or the specialized plugin.

To use Search & Replace, use menu Search -> Replace, click Multi Line, hit enter twice in Search for field and leave Replace with field empty.

To use the plugin, use menu Plugins -> Manage Plugins, go to Plugin Catalog tab, install Remove Empty Lines by pmk65. After that you can use it from menu Plugins -> Remove Empty Lines.
Blumentals Software Programmer
energylevels
Posts: 36
Joined: Sat Feb 21, 2015 1:50 am

Re: Delete ALL Empty Lines In PHP File

Post by energylevels »

Thanks the plugin worked although it takes while on large files :D

The find and replace method leaves me with more of a minified file which isn't what I wanted.
User avatar
pmk65
Posts: 678
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: Delete ALL Empty Lines In PHP File

Post by pmk65 »

energylevels wrote:Thanks the plugin worked although it takes while on large files :D
I made an update a while ago, but haven't bothered updating the filelink as there was no feedback. (Without feedback, I have to assume that people don't use the plugin. And as such they don't need/want updates.)

But send me a PM if you are interested in testing the new version.

The new version does the replacement in one take, without looping over each line. So it should be MUCH faster than the old version. ;)
There are 10 types of people in the world: Those who understand binary and those who don't.
Post Reply