I have been trying to add an "x" to the begining of a several rows of data. The best I could do is get the x, a carrige return, then the original data.
what I get:
x
1:9:0 2228 56
what I would like:
x1:9:0 2228 56
notice there is about 25 spaces before the first character sometimes this is 24 or 23.
Here is the code I came up with so far, but dazed and confused now.
string holdthis
string srchField[200]
integer chrlen[200]
integer num2
integer Num
integer Count = 0
integer Count2 = 0
string szLine
proc main
Count=0
num=0
num2=0
if fopen 0 "C:\Program Files\symantec\Procomm Plus\Aspect\traffic_fields.txt" READ
while not feof 0
fgets 0 szline
strtok srchField[Count] szline "," 1
strtok holdthis szline "," 1
atoi holdthis chrlen[Count]
Count += 1
endwhile
fclose 0
endif
fopen 1 "C:\Program Files\symantec\Procomm Plus\Aspect\$aaa.txt" CREATE TEXT
if fopen 0 "C:\Program Files\symantec\Procomm Plus\Aspect\701.cap" READ TEXT
while not feof 0
fgets 0 szline
for Count2 = 0 upto Count-1
if strsearch szline srchField[Count2]
strtok holdthis szline " " chrlen[Count2]
strlen holdthis num
if count2 == Count-1
fputs 1 holdthis
else
fwrite 1 holdthis num
fwrite 1 "," 1
endif
endif
endfor
If strsearch szline "Thu "
strtok holdthis szline " " 4
atoi holdthis num2
fputs 1 holdthis
if num2 > 0
fgets 0 szline
fgets 0 szline
fgets 0 szline
fgets 0 szline
while not strsearch szline "# exit"
strlen szline num2
if num2 > 45
fputs 1 "x"
fputs 1 szline
endif
fgets 0 szline
endwhile
endif
endif
endwhile
endif
fclose 0
endproc
what I get:
x
1:9:0 2228 56
what I would like:
x1:9:0 2228 56
notice there is about 25 spaces before the first character sometimes this is 24 or 23.
Here is the code I came up with so far, but dazed and confused now.
string holdthis
string srchField[200]
integer chrlen[200]
integer num2
integer Num
integer Count = 0
integer Count2 = 0
string szLine
proc main
Count=0
num=0
num2=0
if fopen 0 "C:\Program Files\symantec\Procomm Plus\Aspect\traffic_fields.txt" READ
while not feof 0
fgets 0 szline
strtok srchField[Count] szline "," 1
strtok holdthis szline "," 1
atoi holdthis chrlen[Count]
Count += 1
endwhile
fclose 0
endif
fopen 1 "C:\Program Files\symantec\Procomm Plus\Aspect\$aaa.txt" CREATE TEXT
if fopen 0 "C:\Program Files\symantec\Procomm Plus\Aspect\701.cap" READ TEXT
while not feof 0
fgets 0 szline
for Count2 = 0 upto Count-1
if strsearch szline srchField[Count2]
strtok holdthis szline " " chrlen[Count2]
strlen holdthis num
if count2 == Count-1
fputs 1 holdthis
else
fwrite 1 holdthis num
fwrite 1 "," 1
endif
endif
endfor
If strsearch szline "Thu "
strtok holdthis szline " " 4
atoi holdthis num2
fputs 1 holdthis
if num2 > 0
fgets 0 szline
fgets 0 szline
fgets 0 szline
fgets 0 szline
while not strsearch szline "# exit"
strlen szline num2
if num2 > 45
fputs 1 "x"
fputs 1 szline
endif
fgets 0 szline
endwhile
endif
endif
endwhile
endif
fclose 0
endproc