Tentaal Posted July 17, 2007 Posted July 17, 2007 Hello, Is there a function to remove all blank lines in a text file? I was trying this but it does not work : $ReplacedString = _ReplaceStringInFile($filename,"",CHR(008)) :-) Thanks !
poisonkiller Posted July 17, 2007 Posted July 17, 2007 #include <File.au3> $file = FileOpenDialog("Open...", @DesktopDir, "Text files (*.txt)") $lines = _FileCountLines($file) $buffer = "" For $i = 1 to $lines $line = FileReadLine($file, $i) If $line <> "" Then $buffer &= $line & @CRLF EndIf Next FileDelete($file) FileWrite($file, $buffer)
Tentaal Posted July 17, 2007 Author Posted July 17, 2007 Well, here you delete the file and recreate it without blank line. It's a solution, but what if I dont want to delete the file?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now