Jump to content

find numbers in a file, maybe StringRegExp?


Recommended Posts

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]

Link to comment
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

Link to comment
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]

Link to comment
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]

Link to comment
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]

Link to comment
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]

Link to comment
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]

Link to comment
Share on other sites

  • Moderators

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

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.

Link to comment
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
Link to comment
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]

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...