Jump to content

File


Tiger
 Share

Recommended Posts

Ok, so ... what does that mean? You want us to code it for you?

SURVEY SAYS!!!

BZZZZZZT!!!!

Strike one. If you get to three strikes, the Admin family gets a chance to steal!

Ok, top 5 answers on the board...when surveyed, 100 forum members said you should ...

1) Do it yourself and then post code when you get stuck for help!!!

*good answer*good answer*good answer*

SURVEY SAYS!!!

DING!!!

Number one answer!!!

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

The script:

#include <Array.au3>
#include <File.au3>

Local $file_1
Local $file_2

_FileReadToArray(@ScriptDir & "\file_1.txt", $file_1)
_FileReadToArray(@ScriptDir & "\file_2.txt", $file_2)

For $x = 1 To UBound($file_1) - 1
    
    For $y = 1 To UBound($file_2) - 1
        
        If StringInStr($file_1[$x], $file_2[$y]) Then
            ; Nothing
        Else
            _ArrayDelete($file_1, $x)
        EndIf
    Next
Next
My UDFs:- _RegEnumKey
Link to comment
Share on other sites

Dang. I missed out on the Family Feud action.

Let me see if I can clarify the problem (?????):

File 1 contains links (chain links?, sausage links?, web links with proper html tags?).

File 2 contains numbers (integers?, floats?, non-reals?)

Now you need to search the links in File 1 for the numbers in File 2, and if no match is found, add it.

Help us to help you.

Link to comment
Share on other sites

Hey Tiger,

I don't know if this speaks to your issue or not, but running the script gave me a couple of "array out-of-bounds" errors.

When the script removes an item from the array, it doesn't necessarily cause the loop to re-evaluate the UBound.

Iterating backwards avoids the error. Also, breaking out of the inner loop when the condition is met prevents another "out-of-bounds" error from occurring. Am I using the script inappropriately? <_<

#include <Array.au3>
#include <File.au3>

Local $file_1
Local $file_2

_FileReadToArray(@ScriptDir & "\file_1.txt", $file_1)
_FileReadToArray(@ScriptDir & "\file_2.txt", $file_2)

For $x = ( UBound($file_1) - 1 ) to 1 step - 1  
    For $y = ( UBound($file_2) - 1 ) to 1 step - 1
        If StringInStr($file_1[$x], $file_2[$y]) Then
        ; Nothing
        Else
            _ArrayDelete($file_1, $x)
            ExitLoop
        EndIf
    Next
Next
Edited by zfisherdrums
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...