Archive: Replacing line with ${linefind}


Replacing line with ${linefind}
i'm trying to replace some lines in the text file with linefind, i tried the combination of deleting lines then insert lines, using the examples listed in http://nsis.sourceforge.net/Docs/AppendixE.html#E.2.2 .

Inserting lines working fine, but delete lines always delete the first line of the file plus the line(s) i specified. Another serious issue when using linefind to delete lines is that it drop all the lines wchinese characters.

I'm using unicode nsis and the text file with chinese characters is encoded in utf-8.

So any thought of what i'm doing wrong?? The code i used was exactly the same as shown in the example except for the filenames & line numbers and of course the line i'm going to replace.

Thank you.


It may be easier to write your own function which enumerates file A while generating file B and then afterwards overwrites file A with file B. There are many functions on the Wiki which do this.

Stu


errr, ok. I try to find out other way to do it then.


also, any other precautions for messing with utf-8 + chinese characters?

i tried other functions found in google, but they all drop chinese characters and delete the first line of the file.

other than linefind, can i use filewrite + fileseek to delete a line from the file??


No as I said (but in a little greater detail):

Open your file A
Open new file B
For each line in A
Write to B unless line = line to delete
Close A
Close B
Delete B
Rename A -> B

Stu