The line you used is correct to overwrite a line, here is an example:
alias test_write {
write -c test LINE1 $+ $crlf $+ LINE2 $+ $crlf $+ LINE3
write -w"LINE2" test NEWLINE2
echo -a $read(test,tn,1) -- $read(test,tn,2) -- $read(test,tn,3)
.remove test
}
Nillens: $readn is only filled after a $read() call, using /write -w is much much better, $read will open the file, check all the line, try to match them, then on a match, fills $readn, close the file. You would then use /write -l $readn, which would open the file, go to the $readn line, and replace it. In short, the whole $read part can be avoided, speeding up the processing greatly.