Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Remove Delete Skip Line File Array Keyword Matching Text ArrayRemove ArrayLocate StrIndex StrIndexNC ArrayFileGet ArrayFilePut
ignorekeyword = 'hello' ; Case Insensitive inputfilename = "c:\temp\test.txt" outputfilename = "c:\temp\testout.txt" inputarray = ArrayFileGet (inputfilename , "" , 0) linecount = ArrInfo(inputarray,6) -1 For index = 0 To linecount line = inputarray[index] position = StrIndexNC( line, ignorekeyword, 1, @FWDSCAN ) ; Skip lines where keyword is found If position != 0 ; Remove line/element from the array ArrayRemove( inputarray, index ) index = index-1 linecount = linecount-1 EndIf Next ArrayFilePut(outputfilename, inputarray) Pause( "", "Done" ) Exit
Article ID: W17665
Filename: Remove a Line from a File Using Arrays.txt
File Created: 2012:10:24:10:29:16
Last Updated: 2012:10:24:10:29:16