Page 1 of 1

Comparing lists

Posted: 23 Mar 2022 20:30
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

Re: Comparing lists

Posted: 23 Mar 2022 20:40
by highend
?

Re: Comparing lists

Posted: 23 Mar 2022 20:56
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.

Re: Comparing lists

Posted: 23 Mar 2022 21:11
by highend
Sorry, but you really can't find out why this happens?

A hint: NO WILDCARDS^^

Re: Comparing lists

Posted: 23 Mar 2022 21:24
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?

Re: Comparing lists

Posted: 23 Mar 2022 21:31
by highend
Without knowing what you've changed in the script? Nope^^

Re: Comparing lists

Posted: 23 Mar 2022 21:40
by tiago
I just removed the "w" parameter as indicated for the gettokenindex command...

Re: Comparing lists

Posted: 23 Mar 2022 21:43
by highend
Show the full script...

Re: Comparing lists

Posted: 23 Mar 2022 21:46
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";

Re: Comparing lists

Posted: 23 Mar 2022 21:54
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

Re: Comparing lists

Posted: 23 Mar 2022 22:09
by tiago
It's not working here.

Re: Comparing lists

Posted: 23 Mar 2022 22:20
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)...