Jump to content

Read out URL from .txt


Recommended Posts

  • Moderators

Look at the following in the help file:

  • FileReadToArray(filename)
  • For..In Loop (For $element in $aArray) to loop through each line in the file
  • StringInStr - If StringInStr($element, "mytext") Then DoSomething.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

I parsed a 3MB text file to an array in less than a second, exactly what level of efficiency are you looking to achieve?

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

Something like this? Finishes in just over a second for me on a 3MB file full of URLs.

#include <Array.au3>
#include <FileConstants.au3>

$sFile1 = FileOpen(@DesktopDir & "\1.txt", $FO_READ)
$sFile2 = FileOpen(@DesktopDir & "\2.txt", $FO_APPEND)

Local $aArray = FileReadToArray($sFile1)
    For $element in $aArray
        If StringInStr($element, "aslpro.com") Then FileWriteLine($sFile2, $element)
    Next

FileClose($sFile1)
FileClose($sFile2)
Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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