Hi, I'm new to Kix scripting, so this may be a simple question.

I've made a script, that runs everytime the user logs on, and collects PCname and MAC-address and writes it to a tekstfile, so I can use the file to shutdown (uses the PC name) and Wake-on-Lan (uses the MACaddress) all our machines. Sometimes we reinstall our PC's and rename so I can't be sure that once the MAC-address is writen, the corresponding PCname is correct. Therefore I want the script to read the tekstfile, check if the MAC-address is allready there. If found then check if the PCname is correct and delete the line if its not correct. Offcourse the script will write a line if the MAC-address isen't found.
I managed to everything except delete the line in the file. How can i do that.
I have not solved the problem with automatical removing old entries from old revomed pc's
Is there an easier way to solve my problem?
The ini.txt file holds lines from each Pc in the format: Ipaddress,PCname,Macaddress

If Open(3, c:\ini.txt) = 0
$x=ReadLine(3)
While @ERROR = 0
$p=Split($x, ",")

If $p[2]="MAC-address"
If $p[1]="PCname"
$=Close(3)
Goto "end"
Else
"Delete line?"
$=Close(3)
Goto "write"
EndIf
EndIf
$x=ReadLine(3)
Loop
$=Close(3)
EndIf
Goto "end"

:write
If Open(4, c:\ini.txt,4) = 0
$ = WriteLine (4, Ipaddress,PCname,Macaddress + @CRLF)
$ = Close(4)
EndIf

:end