Jump to content

Removal of empty rows from a text file


Recommended Posts

... one of possible ways:

#include <FileConstants.au3>

$handle = FileOpen("BlankLines.txt") ; open file (read mode)
$sContent = FileRead($handle) ; read content
FileClose($handle)

Do ; remove double carriage-returns (white lines)
    $sContent = StringReplace($sContent, @CRLF & @CRLF, @CRLF)
Until Not @extended

$handle = FileOpen("No_BlankLines.txt", $FO_OVERWRITE) ; write result in a new file
FileWrite($handle, $sContent)
FileFlush($handle)
FileClose($handle)

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...