Jump to content

Recommended Posts

Posted

Hi everybody,

 

i have a simple question, i have a text file with empty rows, i want to remove/delete them. Is there any function which might help me?

 

Thanks in advance.

 

Regards

Posted

... 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....

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
×
×
  • Create New...