Comparing lists

Discuss and share scripts and script files...
Post Reply
tiago
Posts: 589
Joined: 14 Feb 2011 21:41

Comparing lists

Post by tiago »

Hey guys!

I'm trying to compare lists generating three files as outputs, splitting uniques and commom from each. But the script stales at a point and I'm not sure why? Please help. Attached the code I'm using for this.

list 1

(Not Escape Room)
.dungeon
/dia
[ENDLESS_OVERDRIVE]
[Inkbit] Pixel Art Font Set
[MOOD] Pixel Art Font Set
[New Hi-Score] Pixel Art Font
[Speer]

list 2

(Not Escape Room)
.dungeon
/dia
commom 1
[ENDLESS_OVERDRIVE]
commom 2
[MOOD] Pixel Art Font Set
[New Hi-Score] Pixel Art Font
Attachments
comparelists.xys
(996 Bytes) Downloaded 77 times
Power-hungry user!!!

highend
Posts: 13308
Joined: 06 Feb 2011 00:33

Re: Comparing lists

Post by highend »

?
One of my scripts helped you out? Please donate via Paypal

tiago
Posts: 589
Joined: 14 Feb 2011 21:41

Re: Comparing lists

Post by tiago »

Here,

[Speer]

is listed as common, which is not.

[MOOD] Pixel Art Font Set
[New Hi-Score] Pixel Art Font

are under "unique on list 2", but they are common to both lists.
Power-hungry user!!!

highend
Posts: 13308
Joined: 06 Feb 2011 00:33

Re: Comparing lists

Post by highend »

Sorry, but you really can't find out why this happens?

A hint: NO WILDCARDS^^
One of my scripts helped you out? Please donate via Paypal

tiago
Posts: 589
Joined: 14 Feb 2011 21:41

Re: Comparing lists

Post by tiago »

"no wildcards" makes the [ENDLESS_OVERDRIVE] and (Not Escape Room) entries be listed as "unique", they aren't.

Any way to solve this?
Power-hungry user!!!

highend
Posts: 13308
Joined: 06 Feb 2011 00:33

Re: Comparing lists

Post by highend »

Without knowing what you've changed in the script? Nope^^
One of my scripts helped you out? Please donate via Paypal

tiago
Posts: 589
Joined: 14 Feb 2011 21:41

Re: Comparing lists

Post by tiago »

I just removed the "w" parameter as indicated for the gettokenindex command...
Power-hungry user!!!

highend
Posts: 13308
Joined: 06 Feb 2011 00:33

Re: Comparing lists

Post by highend »

Show the full script...
One of my scripts helped you out? Please donate via Paypal

tiago
Posts: 589
Joined: 14 Feb 2011 21:41

Re: Comparing lists

Post by tiago »

$now = formatdate(, "yyyy_mm_dd_hhnnss");
$name = "compared List_" . "$now";

$name1 = "$name" . "_unique On List 1";
$name2 = "$name" . "_unique On List 2";
$name3 = "$name" . "_COMMON";

echo "Copy the FIRST source list to the clipboard and press OK!";
$listA = "<clipboard>" . "<crlf>";
echo "Now copy the SECOND list to the clipboard, then press OK!";
$listB = "<clipboard>" . "<crlf>";

step;

foreach($tk, "$listA", "<crlf>") {
$tst = gettokenindex(trim("$tk", "<tab> "), "$listB", "<crlf>", i);
if("$tst" == 0) { writefile("$name1" . ".txt", "$tk<crlf>", a, tu); }
else { writefile("$name3" . ".txt", "$tk<crlf>", a, tu); }
}

step;

foreach($tk, "$listB", "<crlf>") {
$tst = gettokenindex(trim("$tk", "<tab> "), "$listA", "<crlf>", i);
if("$tst" == 0) { writefile("$name2" . ".txt", "$tk<crlf>", a, tu); }
else { }
}

echo "done";
Power-hungry user!!!

highend
Posts: 13308
Joined: 06 Feb 2011 00:33

Re: Comparing lists

Post by highend »

[ENDLESS_OVERDRIVE] and (Not Escape Room) entries be listed as "unique"
Not here...

Code: Select all

compared List_2022_03_23_215101_COMMON.txt

(Not Escape Room)
.dungeon
/dia
[ENDLESS_OVERDRIVE]
[MOOD] Pixel Art Font Set
[New Hi-Score] Pixel Art Font

Code: Select all

compared List_2022_03_23_215101_unique On List 1.txt

[Inkbit] Pixel Art Font Set
[Speer]

Code: Select all

compared List_2022_03_23_215101_unique On List 2.txt

commom 1
commom 2
One of my scripts helped you out? Please donate via Paypal

tiago
Posts: 589
Joined: 14 Feb 2011 21:41

Re: Comparing lists

Post by tiago »

It's not working here.
Power-hungry user!!!

highend
Posts: 13308
Joined: 06 Feb 2011 00:33

Re: Comparing lists

Post by highend »

My guess:

At least one list has at least 1 entry, that is indented (by either space(s) or tab(s) / a mix of them)...
One of my scripts helped you out? Please donate via Paypal

Post Reply