ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

Remove empty lines

<< < (2/2)

rsatrioadi:
Use sed? :P

Contro:
 :-*
I have notepad++
Running to do

Edvard:
Download this:
http://gnuwin32.sourceforge.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.com/howto/windows-vista/add-any-application-to-the-desktop-right-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:
Remove empty lines in a txt file-Contro (June 30, 2013, 07:24 PM)
--- End quote ---

See file content:

--- Code: Text ---C:\>TYPE input.txt


Filter for lines not (/V) being empty (^$):

--- Code: Text ---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 ---C:\>TYPE input.txt | findstr /V "^$" > output.txt

More about at http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/findstr.mspx


.

Navigation

[0] Message Index

[*] Previous page

Go to full version