Cleaning a txt file from dupes ...
Posted: Fri Oct 08, 2004 2:54 pm
Im looking for a way to clean a txt file from all the dupes inside
For example transform :
../file.txt
amero
ameri
amerp
amero
amerp
amera
in ../file.txt
ameri
amera
so removing amerp / amero
heres a part of code i wrote :
i was hoping to add a textdata ( parsed by "." as strings ) in a file.txt ONLY if FindString return 0 ( meaning the textdata not yet on file.txt ) , but for now all is written , even dupe words ...
have someone a hint ( lib or routine ) to clean a text file like this , or stop the write process of a string if a line in this txt allready contains the specified string ?
thks for any help
For example transform :
../file.txt
amero
ameri
amerp
amero
amerp
amera
in ../file.txt
ameri
amera
so removing amerp / amero
heres a part of code i wrote :
Code: Select all
Procedure CleanText()
totalstring.l=CountString(textdata,".") + 1
ReadFile(1,"file.txt")
While Eof(1) = 0
text$=text$+ReadString()
For K = 1 To totalstring.l
If FindString(text$,StringField(textdata, K, "."),1) = 1 : Break : EndIf
If FindString(text$,StringField(textdata, K, "."),1) = 0
UseFile(1)
WriteStringN(StringField(textdata, K, "."))
EndIf
Next K
Wend
EndProcedure
have someone a hint ( lib or routine ) to clean a text file like this , or stop the write process of a string if a line in this txt allready contains the specified string ?
thks for any help