Using Raku (formerly known as Perl_6)
~$ raku -e 'my %hash1; for "path/to/file1.txt".IO.lines() {
.split("= ") andthen %hash1.append: .[0] => .[1].split(",") };
my %hash2; for "path/to/file2.txt".IO.lines() {
.split("= ") andthen %hash2.append: .[0] => .[1].split(",") };
for (%hash1.keys ∩ %hash2.keys).map(*.key) -> $i {
unless %hash1{$i} == %hash2{$i} {
put ($i ~ "= " ~ %hash1{$i}.join(",") ~ " != " ~ $i ~ "= " ~ %hash2{$i}.join(",")) // next} };
my ($k2,$v2) = %hash2{(%hash2.keys (-) %hash1.keys)}:kv;
my ($k1,$v1) = %hash1{(%hash1.keys (-) %hash2.keys)}:kv;
put $k2 ~ "= " ~ $v2.join(",") ~ " cannot be found in File 1!" // next;
put $k1 ~ "= " ~ $v1.join(",") ~ " cannot be found in File 2!" // next;'
Sample Output:
Artikel[ 5091270000 ]= C4 != Artikel[ 5091270000 ]= C4,C19,C34
Artikel[ 5089100000 ]= C3 != Artikel[ 5089100000 ]= C3,C5
Artikel[ 4005530901 ]= C10 cannot be found in File 1!
Artikel[ 5129720100 ]= C13 cannot be found in File 2!
Above is an answer written in Raku, the newest member of the Perl-family of programming languages. Raku features high-level support for Unicode built-in, as well as an advanced Regex engine. This answer takes advantage of Raku's %-sigiled hash (key-value) data-structure (a feature of Perl-family languages).
Briefly, files are read-in linewise into a %hash: the line is split on = to give two parts, and the .[0] first part becomes the key while the comma-split second part (.[1]) becomes the value.
Raku has Set functions built-in, so you can get the Intersection of hash-keys simply by writing %hash1.keys ∩ %hash2.keys (using either the Unicode infix ∩ character or the 3-character ASCII infix (&) ).
From the Intersection result, the code %hash{$k} is a basic key lookup to return the associated value(s). With this knowledge you can build an output string (~ tilde is used to concatenate strings together). Hash keys for which values are equal will not be output because of the unless %hash1{$i} == %hash2{$i} clause (unless is the same as if not).
Raku also has Set Difference functions, here represented by the 3-character ASCII infix (-). The 3-character ASCII infix (-) is used because the actual Unicode "SET-MINUS" symbol ∖ (U+2216) is easily confused with another. Both hash-key differences are computed, an output string is constructed for each, and each output.
Note 1: The code above makes no assumptions about the unique-ness of values per key. So if you have duplicate values in one file (but not the other), it will show up in the output as a difference. To make values unique per hash, add unique to each hash constructor, e.g. %hash.push: .[0] => .[1].split(",").unique.
Note 2: The above code doesn't try to simplify the "Artikel" key, but you'd probably do better to simplify each .[0] key down to only digits using a Regex, like so: .[0].match(/ \d+ /).Str.
Note 3: in this example input paths are hard-coded , but you could hard-code one (a proof file) and take a test file off the command line with $*ARGFILES.IO.lines() {...};, or even $*IN.IO.lines() {...}; (making sure to < redirect STDIN appropriately). See the second link below for more CLI options (e.g. using Raku's @*ARGS command-line array, etc).
https://docs.raku.org/language/setbagmix#Sets,_bags,_and_mixes
https://docs.raku.org/language/create-cli
https://raku.org
C3, C5be the same asC5, C3or different? Does the order of entries matter?