Jump to content

Search the large text file


Lesler
 Share

Recommended Posts

Hello

I have a big text file in which I must find a path.

Fx

S:\finnpower\1.5mm\12273\12273-10-02.cp

S:\finnpower\1.5mm\12304\12304-02-03.cp

S:\finnpower\1.5mm\12389\12389-01-01.cp

S:\finnpower\1.5mm\12389\12389-01-02.cp

S:\finnpower\1.5mm\12389\12389-01-03.cp

S:\finnpower\1.5mm\12389\12389-02-01.cp

S:\finnpower\1.5mm\12389\12389-02-02.cp

S:\finnpower\1.5mm\12389\12389-02-03.cp

If I am so looking for 12389-02-01

I want my program to Return

S:\finnpower\1.5mm\12389\12389-02-01.cp

Do any of you who have an idea of how

it can be done.

Excuse my bad english, google translate is not better. ;)

Thanks in advance

Martin

Link to comment
Share on other sites

Try this

#include <file.au3>

Dim $aRecords
If Not _FileReadToArray("bigtextfile.txt",$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array    error:" & @error)
   Exit
EndIf
For $x = 1 to $aRecords[0]
    If StringInStr ( $aRecords[$x], '12389-02-01' ) <> 0 Then ConsoleWrite ( "$aRecords[" & $x & "] : " & $aRecords[$x] & @Crlf )
Next
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Thanks for your prompt response.

Will you help me get the answer.

I can not figure out how to get the reply

S:\finnpower\1.5mm\12389\12389-02-01.cp

To fx example, a MsgBox

Thanks in advance ;)

Like this ?

#include <file.au3>

Dim $aRecords
If Not _FileReadToArray("bigtextfile.txt",$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array    error:" & @error)
   Exit
EndIf
For $x = 1 to $aRecords[0]
    If StringInStr ( $aRecords[$x], '12389-02-01' ) <> 0 Then 
        MsgBox ( 0, '', "$aRecords[" & $x & "] : " & $aRecords[$x] )
        ExitLoop
    EndIf
Next

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...