Jump to content
UBot Underground

Compare Two Lists (Beginner)


Recommended Posts

Hello all together,

i have a Question to all Ubot Users:

I have two Lists, List1 and List2. I want to delete all Lines in List1 where the Url in List two is not in!

Example List 1:

Name,Email,Login,Password,URL (3000 Entrys)

Example List 2:

Only URL(500 Entrys Unique)

 

So after Compare i want to have only 2 Lists with 500 Entry`s.

I hope someone understand me. English is not my First language.

Thanks

Link to post
Share on other sites

Subtract lists won't work in this case since he wants to keep the other information in tact. If you were to use it and the items don't match up identically then they won't remove them. So in this case we need to add the items to a table and then loop through comparing them one at a time. Unfortunately table search won't work in this case either since you want the exact match. I created an example on how to do this for you:

 

You will need to modify this a bit, for example I only used 2 columns and you used 5 so inside of the loop -> loop -> if comparison change the $table cell column to be 4

 

Make sure you enable the Table Commands plugin for this:

clear list(%big_list)
clear list(%small_list)
add list to list(%big_list,$list from text("1,http://google.com
2,http://yahoo.com
3,http://facebook.com
4,http://twitter.com
5,http://ubotstudio.com",$new line),"Delete","Global")
add list to list(%small_list,$list from text("http://google.com
http://twitter.com",$new line),"Delete","Global")
clear table(&data)
comment("Only use this command if the list is formatted like it is above
with commas separating the values and lines separating the rows
otherwise loop through to add in the values one by one")
create table from text(&data,%big_list)
loop($list total(%small_list)) {
    set(#next_item,$next list item(%small_list),"Global")
    set(#row_num,0,"Global")
    loop($table total rows(&data)) {
        if($comparison(#next_item,"=",$table cell(&data,#row_num,1))) {
            then {
                comment("DO NOT increment if you delete a row or
you will get off track")
                plugin command("TableCommands.dll", "delete from table", &data, "Row", #row_num)
            }
            else {
                increment(#row_num)
            }
        }
    }
}
Link to post
Share on other sites

the table search function is pretty good for this type of thing

 

add list 1 to a table,

 

loop through list 2,if an item is not found do nothing,if it is found,add it to a new list,so list 3 in your above example would be 500

 

*EDIT* didnt really understand the question,credit to HInsomnia for getting it

add list to list(%one,$list from text("1
2
3
4
5",$new line),"Delete","Global")
add list to list(%two,$list from text("4
5
6
7
8",$new line),"Delete","Global")
add list to table as column(&myTable,0,0,%one)
loop($list total(%one)) {
    set(#nxtItem,$next list item(%two),"Global")
    if($comparison($plugin function("TableCommands.dll", "$table search", &myTable, #nxtItem, "Row Index"),">","-1")) {
        then {
            add item to list(%three,#nxtItem,"Don\'t Delete","Global")
        }
    }
}

Link to post
Share on other sites
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...