can't get this to work. What I have is a text file, containing data like this:
What I want is to replace the number values (second column) with new ones, e. g. 82.83 with 79.98. But what I get is:2021-06-0182.83
2021-07-0184.45
So the new values are appended and I even get empty rows in between . This is my code:2021-06-0182.83
2021-07-0184.45
2021-07-0179.98
2021-08-0182.02
2021-09-0178.95
Code: Select all
put specialFolderPath("resources") & "/" & "test.txt" into vPath
open file specialFolderPath("resources") & "/" & "test.txt" for update
read from file specialFolderPath("resources") & "/" & "test.txt" until EOF
repeat for each word i in it
if i contains "." then
put theNewValue into n
replace i with n in it
end if
end repeat
write it to file specialFolderPath("resources") & "/" & "test.txt"
close file specialFolderPath("resources") & "/" & "test.txt"