My goal is to parse a source text file and if any lines contain a hyphen then write that line to a new txt file. So the resulting product file will be a subset of the first file, but only lines that contain a hyphen.
Here's what I got:
$input = FileOpen("C:tempsource.txt", 0)
$output = FileOpen("C:tempdone.txt", 2)
Do
$line = FileReadLine($input)
If StringInStr($line, "-") Then FileWriteLine($output, $line)
Until @error = -1
FileClose($input)
FileClose($output)
Problem is, my resulting file only contains the first instance of a line with a hypen, which is repeated over and over again. It's as if the script isnt moving to the next line the 2nd time it executes FileReadLine. The documentation says FileReadLine should automatically increment and read the next line in an opened file, so there shouldn't be any need to set up a counter to guide it.
Any ideas why I'm getting this problem then? What simple thing am I missing? Much TiA.