View Full Version : how to search for and strip a blank line from text file


=?Utf-8?B?R2FyeSBDaGFu?=
11-05-2003, 06:06 PM
In batch file, how do I search for and strip blank line from a text file?

Ray at
11-05-2003, 06:19 PM
for /f %q in (file.txt) do (if {%q} NEQ {} echo %q>>file2.txt)

That'll give you a new file sans blank lines, which you can then rename to
the original file name after deleting the original file.

Ray at work

"Gary Chan" <anonymous@discussions.microsoft.com> wrote in message
news:F8D97736-4939-43B6-BD0A-5F485A0D7413@microsoft.com...
> In batch file, how do I search for and strip blank line from a text file?

Ray at
11-05-2003, 06:19 PM
for /f %q in (file.txt) do (if {%q} NEQ {} echo %q>>file2.txt)

That'll give you a new file sans blank lines, which you can then rename to
the original file name after deleting the original file.

Ray at work

"Gary Chan" <anonymous@discussions.microsoft.com> wrote in message
news:F8D97736-4939-43B6-BD0A-5F485A0D7413@microsoft.com...
> In batch file, how do I search for and strip blank line from a text file?