Sign in to follow this  
Followers 0
Kreatorul

File Search(inside the file)?

4 posts in this topic

I want to search a text/html document for a given string and in return I want to see the line number of where the string is located. Like $search=FileSearch("autoit", "c:/games/blahblah.txt") and then MsgBox("Autoit", "Autoit was found in line $search"). Maybe there's a function like that in autoit and I couldn't find it and searching the forums doesn't return exact results.

Share this post


Link to post
Share on other sites



What you'll need:

[*] FileOpen

[*] FileRead

[*] StringInStr and/or StringRegExp

Then some way to determine which line it's on. I'd try something like this

$chunk = StringLeft($fileContents, $stringFound)
StringReplace($chunk, @LF, '')
$lineFound = @extended

Share this post


Link to post
Share on other sites

Gee, glad I could help...

Share this post


Link to post
Share on other sites

Gee, glad I could help...

You didn't get a response due to the banning:

#484694

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