Sign in to follow this  
Followers 0
ConsultingJoe

find numbers in a file, maybe StringRegExp?

17 posts in this topic

ok, what i am trying to do, is find the location in a file where there is 17 unknown numbers, a space, and 17 other unknown numbers.

I thought that StringRegExp could be used for it but I dont know how to use it.

Can someone PLEASE HELP

THANKS


[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites



maybe...

#include <file.au3>

Dim $aRecords

If Not _FileReadToArray("error.log",$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf

For $x = 1 to $aRecords[0]
    $split = StringSplit($aRecords[$x], " ")
    for $t = 1 to $split[0]
        If StringLen($split[$t]) = 17 Then
            If StringLen($split[$t-1]) = 17 Then
                Msgbox(0,'Record:' & $x, $aRecords[$x] & @CRLF & $split[$t] & @CRLF & $split[$t-1])
                ExitLoop
            EndIf
        EndIf
    Next
Next

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

$aRecords[0] doesnt hold the lines???


[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

$aRecords[0] doesnt hold the lines???

the file is a database file so there is weired charactors, that can effect it, i think?

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

It wouldn't. The file is probably way too big. When you say "number", you mean digit, correct? As in the numbers 1-9 and 0?

Share this post


Link to post
Share on other sites

the code i gave above just worked for me... it found that same series of numbers three times

did you change this????

If Not _FileReadToArray("error.log",$aRecords) Then


NEWHeader1.png

Share this post


Link to post
Share on other sites

Sorry Valuater, I didn't see the link to the file. I just figured the file was too big to fit into an array. I assumed he was trying to work with a game file.

Share this post


Link to post
Share on other sites

the code i gave above just worked for me... it found that same series of numbers three times

did you change this????

If Not _FileReadToArray("error.log",$aRecords) Then

Ok, yes it does work thanks, but why does it have to be in the same directory?

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

Ok, yes it does work thanks, but why does it have to be in the same directory?

It doesn't *have* to be. You just have to add code to locate the file otherwise.

Share this post


Link to post
Share on other sites

geeze... want me to come over and give personal instructions...... lol

@DesktopDir & "\Server.dbs"

works if it is on your desktop... you can use any folder you want

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

geeze... want me to come over and give personal instructions...... lol

:nuke:

Could you do that?! :P

Share this post


Link to post
Share on other sites

geeze... want me to come over and give personal instructions...... lol

@DesktopDir & "\Server.dbs"

works if it is on your desktop... you can use any folder you want

8)

LOL, I know how to do it, thanks. I must have just done something wrong. it works great

thanks a bunch


[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

Welcome

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

ok, what i am trying to do, is find the location in a file where there is 17 unknown numbers, a space, and 17 other unknown numbers.

I thought that StringRegExp could be used for it but I dont know how to use it.

Can someone PLEASE HELP

THANKS

$sString = 'adkfjow 11111111122222233 44444444445555566 aldfoi'
$aSRE = StringRegExp($sString, '([0-9]{17} [0-9]{17})', 3)
If @extended Then
    For $iCC = 0 To UBound($aSRE) - 1
        MsgBox(64, 'Info', $aSRE[$iCC])
    Next
EndIf

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Yes1

Or..

;regsre.au3
#include<StringRegExpVBS.au3>
$s_FileRead="zzzzz23478903467896745 23478903467896745cccc"
$ar_Found=_StringRegExp($s_FileRead, '([\d]{17} [\d]{17})')
$i_pos=StringInStr($s_FileRead,$ar_Found[0])
MsgBox(0,"","$i_pos="&$i_pos)
Randall

Share this post


Link to post
Share on other sites

$sString = 'adkfjow 11111111122222233 44444444445555566 aldfoi'
$aSRE = StringRegExp($sString, '([0-9]{17} [0-9]{17})', 3)
If @extended Then
    For $iCC = 0 To UBound($aSRE) - 1
        MsgBox(64, 'Info', $aSRE[$iCC])
    Next
EndIf
thank you, I am interested in StringRegExp some more. I'm going to study it harder. thanks

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
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
Sign in to follow this  
Followers 0