Jump to content

Search the Community

Showing results for tags 'delete blank lines in txt'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Friends,I can not delete blank lines in txt file TXT.txt File Line1 Line2 Line5 Line8 #include <array.au3> #include <file.au3> #include <String.au3> #include <StringConstants.au3> $Inputbox = InputBox("Enter", "Enter what you want to delete", "", "") If @error Then Exit If Not @error Then Global $File_to_written = @ScriptDir & "\" & "TXT.txt" Local $FileOpen = FileOpen($File_to_written, 2) If $FileOpen = -1 Then Exit MsgBox(17, 'ERROR', 'File open failed for output file') Local $ReadString = FileRead(@ScriptDir & "\OLD" & "\TXTOLD.txt") Local $aTXTSPLIT = StringSplit($ReadString, @CRLF, 3) For $1 = 0 To UBound($aTXTSPLIT) - 1 $ReadString = StringRegExpReplace($aTXTSPLIT[$1],$Inputbox, "") ;----------------------------These parts do not work--------- ;$ReadString = StringRegExpReplace($ReadString, '(?s)[\n\r\t\v]', '') ;$ReadString = StringRegExpReplace($ReadString, "(?m:^)\h*(\r\n|\r|\n)", "") ;$ReadString = StringRegExpReplace($ReadString, '(?m:^\s*[\r\n])', '') ;$ReadString = StringRegExpReplace($ReadString, '(?s)\r\n', '') ;---------------------------These parts do not work------------ $ReadString = StringStripWS($ReadString,8) FileWrite($FileOpen, $ReadString & @CRLF) Next FileClose($FileOpen) EndIf The following codes are working. But I want to do it with StringRegExpReplace Global $aLines _FileReadToArray($File_to_written, $aLines) For $i = $aLines[0] To 1 Step -1 If $aLines[$i] = "" Then _ArrayDelete($aLines, $i) EndIf Next _FileWriteFromArray($File_to_written, $aLines, 1)
×
×
  • Create New...