I know there will be simpler ways...
but (A) I couldn't work out how to back up the file pointer and (B) this works, so I didn't bother.
This sample below will Filter through "C:\Program Files\Symantec\Procomm Plus\Capture\tempfile.txt"
It searches for "0123456789ABCDEF" as the 1st 16 chars of any line.
Each line of the file is written to "swapfile.txt".
If the 1st 16 chars match, that line is written with the replacement characters "_THE_NEW_STRING_".
The second portion overwrites the original file.
proc main
integer LengthStr
string FNameAA = "C:\Program Files\Symantec\Procomm Plus\Capture\tempfile.txt"
string FNameBB = "C:\Program Files\Symantec\Procomm Plus\Capture\swapfile.txt"
string LineInfo
;create a second file with the replacement string
if isfile FNameAA ; Make sure file exists.
if fopen 0 FNameAA READ ; Open file for read.
fopen 1 FNameBB CREATE
while not feof 0 ; Loop to end of file.
fgets 0 LineInfo ; Get line from file.
strlen LineInfo LengthStr ;get Length of Line
if rstrcmp LineInfo "0123456789ABCDEF" 16 ;1st 16 chars match
strupdt LineInfo "_THE_NEW_STRING_" 0 16
endif
fputs 1 LineInfo ;write the string to other file.
endwhile
fclose 0 ; Close the file.
fclose 1 ; Close the file.
endif
else
errormsg "File doesn't exist."
endif
;swap the files....
if isfile FNameBB ; Make sure file exists.
if fopen 0 FNameBB READ ; Open file for read.
fopen 1 FNameAA CREATE ; Blank out the existing file.
while not feof 0 ; Loop to end of file.
fgets 0 LineInfo ; Get line from file.
fputs 1 LineInfo
endwhile
fclose 0 ; Close the file.
fclose 1 ; Close the file.
endif
else
errormsg "File doesn't exist."
endif
endproc