Search the Community
Showing results for tags 'plain text files'.
-
Hello, As always, sorry for my bad english. here is the code i have #include <File.au3> #include <String.au3> $file1 = "d:\doppioniautoit\international.txt" FileOpen($file1, 0) $file2 = "d:\doppioniautoit\standard.txt" FileOpen($file2, 0) For $i = 1 to _FileCountLines($file1) $line = FileReadLine($file1, $i) $aExtract = _StringBetween($line, "(", ")") ;MsgBox(0, $line, $aExtract[0]) $itime = TimerInit() For $x = 1 to _FileCountLines($file2) $line2 = FileReadLine($file2, $x) Local $iPosition = StringInStr($line2, $aExtract[0], 1) ;Local $iPosition = StringRegExp($line2,$aExtract[0], 0) if $iPosition <> 0 then ;MsgBox(0, "Trovato", $aExtract & " " & $line2) endif ConsoleWrite($line2 & @CRLF) Next ConsoleWrite(@TAB&'Str='&TimerDiff($itime)&' ms'&@lf) MsgBox(0, "TIME", @TAB&'Str='&TimerDiff($itime)&' ms'&@lf) Next FileClose($file1)So, what do i want to do? I try to explain with my poor english Basically, i have 2 text files (see attachments below). They both contains movie titles with Director and Year in this form Movie Title (Director, Year) "Standard.txt" contains, mostly, italian titles. "International.txt", as you can image, contains the internationals one. With the script i would like to search for the Director, Year of "international.txt" in the "standard.txt" file. For example... first row of "international.txt" is "¡Atraco! (Cortés, 2012)". The script takes just the "Cortés, 2012" and it searches for it in the standard. txt file. The simple code i wrote works... I tried using StringInStr and using StringRegExp.. they both need about 2 minutes and 30 seconds (stringinstr is little faster) to process one row. I was wondering... is there any other method to make it faster using autoit? Any help would be much appreciated, thx! standard.txt international.txt
- 36 replies
-
- stringinstr
- stringregexp
-
(and 1 more)
Tagged with: