Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 06, 2016, 06:08:21 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Remove empty lines  (Read 2550 times)

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,619
    • View Profile
    • Donate to Member
Remove empty lines
« on: June 30, 2013, 07:24:29 PM »
Remove empty lines in a txt file
I know the only solution : techmechanics

http://textmechanic....ove-Empty-Lines.html

But I would like a free desktop option. Better is portable.
Best Regards

erikts

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 152
    • View Profile
    • Donate to Member
Re: Remove empty lines
« Reply #1 on: June 30, 2013, 07:35:14 PM »
I use Notepad ++, click menu Edit, select Line Operations, then select:
  • Remove Empty Lines, or
  • Remove Empty Lines (Containing blank characters)

Also you can use Notepad2 (portable version is available, ):
  • Select the text
  • Press Alt+R (or via menu Edit|Block|Remove Blank Lines)
« Last Edit: June 30, 2013, 08:38:26 PM by erikts, Reason: Add Notepad2 »

cmpm

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 2,025
    • View Profile
    • Donate to Member
Re: Remove empty lines
« Reply #2 on: June 30, 2013, 07:50:14 PM »
You may want to try Dolphin Text Editor Menu.
It runs in the tray, triggered via hotkey.

http://www.animal-software.com/index.php

x16wda

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 677
  • what am I doing in this handbasket?
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Remove empty lines
« Reply #3 on: June 30, 2013, 08:06:45 PM »
You may want to try Dolphin Text Editor Menu.
It runs in the tray, triggered via hotkey.

http://www.animal-software.com/index.php

I'll second that.  Very convenient.
vi vi vi - editor of the beast

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 36,406
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Remove empty lines
« Reply #4 on: June 30, 2013, 08:25:32 PM »
My Clipboard Help and Spell program will happily take the text selected in any program and do manipulations including removing blank lines, and then paste it back (replacing the original text), and let you set up a hotkey to do this.
« Last Edit: June 30, 2013, 08:31:05 PM by mouser »

rsatrioadi

  • Participant
  • Joined in 2009
  • *
  • Posts: 58
    • View Profile
    • Donate to Member
Re: Remove empty lines
« Reply #5 on: June 30, 2013, 09:34:19 PM »
Use sed? :P

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,619
    • View Profile
    • Donate to Member
Re: Remove empty lines
« Reply #6 on: June 30, 2013, 09:40:27 PM »
 :-*
I have notepad++
Running to do

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 2,888
    • View Profile
    • Donate to Member
Re: Remove empty lines
« Reply #7 on: July 01, 2013, 02:05:46 AM »
Download this:
http://gnuwin32.sour...net/packages/sed.htm

Put it in somewhere in your %PATH%, unless the installer does it for you (haven't tested).

Then do this:
sed -i '/^$/d' filewithblanklines.txt

With a little registry magic, you can even add it as a context menu item.  Look here:
http://www.howtogeek...click-menu-in-vista/

My registry knowledge is a bit rusty, or else I'd tell you exactly how with a .reg file so it only opens up when you right-click TXT files.
Any takers?

AbteriX

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 1,115
    • View Profile
    • Donate to Member
Re: Remove empty lines mit plain old DOS commands
« Reply #8 on: July 01, 2013, 05:59:20 AM »
Remove empty lines in a txt file

See file content:
Code: Text [Select]
  1. C:\>TYPE input.txt



Filter for lines not (/V) being empty (^$):
Code: Text [Select]
  1. C:\>TYPE input.txt | findstr /V "^$"
(piping (|) the output of type to the input of findstr)
(for empty lines possible containing whitespace use: "^\s*$")



Filter and write to new file:
Code: Text [Select]
  1. C:\>TYPE input.txt | findstr /V "^$" > output.txt


More about at http://www.microsoft...s/en-us/findstr.mspx


.