# Scripting-Funktion zum Löschen doppelter Einträge

**URL:** https://community.mp3tag.de/t/scripting-funktion-zum-loschen-doppelter-eintrage/69515
**Category:** Vorschläge
**Created:** [August 23, 2025, 5:04pm UTC](https://community.mp3tag.de/t/scripting-funktion-zum-loschen-doppelter-eintrage/69515 "2025-08-23T17:04:19Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [August 23, 2025, 5:04pm UTC](https://community.mp3tag.de/t/scripting-funktion-zum-loschen-doppelter-eintrage/69515/1 "2025-08-23T17:04:19Z")

</div>

Im Nachgang zum Problem aus diesem Thread:

> [@Split country GB, GBGB, GBGBGB to GB, GB;GB, GB;GB;GB](https://community.mp3tag.de/t/split-country-gb-gbgb-gbgbgb-to-gb-gb-gb-gb-gb-gb/69495/):
>
> Hi, The MusicBrainz expanded plugin gives for the field COUNTRY 2 digit country code. But for some albums it create multiple countries. For example : A Retrospective of House 91'-95', Volume One gives GBGBGB What is the regular expression to separate the 2 digit country code to: GB;GB;GB Thnx

Ich wäre für die Ergänzung der Scripting-Funktionen um eine, die aus einer gegebenen Liste mit definiertem Trennzeichen die Duplikate löscht.  
Der derzeitige Umweg entweder für das Verwenden von Multi-value-Feldern mit anschließendem Löschen von Feldern mit gleichem Namen und Inhalt funktioniert nicht per scripting.  
Der immer wieder zitierte reguläre Ausdruck aus

> [@Merge duplicate words](https://community.mp3tag.de/t/merge-duplicate-words/16289):
>
> Hi, I would like to find in genre duplicate words and merge them together. This is an example of genre tag: Before AFRICA; AFRICA; NATURAL WORLD; NATURE STUDY; NATURE; DRAMA ADVENTURE; DRAMA WORLD; PERCUSSION; INSTRUMENTS SOLO PERCUSSION; WILDLIFE MOVEMENT; DRAMA ADVENTURE; AFRICA; FILM STYLES ANCIENT ROME; AFRICA After AFRICA; NATURAL WORLD; NATURE STUDY; NATURE; DRAMA WORLD; PERCUSSION; INSTRUMENTS SOLO PERCUSSION; WILDLIFE MOVEMENT; DRAMA ADVENTURE; FILM STYLES ANCIENT ROME ; is the …

ist fast nicht zu warten für Anfänger.  
Also ein Befehl wie $dedup(x,s[,c]) mit String x und Separator s und C für case-sensitive wäre meiner Ansicht nach ein schöne Ergänzung.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [August 23, 2025, 6:20pm UTC](https://community.mp3tag.de/t/scripting-funktion-zum-loschen-doppelter-eintrage/69515/2 "2025-08-23T18:20:32Z")

</div>

Ich hatte kurz vor der Veröffentlichung der v3.31 schon damit angefangen eine solche Funktion zu implementieren, konnte dann aber nicht mehr ausgiebig genug testen.

Du könntest also schon jetzt diese Funktion (abgesehen von C für case-sensitive) ausprobieren 😎

Es sind damit dann auch Dinge wie `$dedup($meta_sep(field,\\),\\)` möglich.

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [August 23, 2025, 6:43pm UTC](https://community.mp3tag.de/t/scripting-funktion-zum-loschen-doppelter-eintrage/69515/3 "2025-08-23T18:43:26Z")

</div>

Zuerst mal: wow!  
Derzeit scheint es wirklich auf die Schreibweise anzukommen.  
Nimmt man die Liste

```auto
AfRICA; Africa; Natural World; Nature Study; Nature; Drama Adventure; Drama World; Percussion; Instruments Solo Percussion; Wildlife Movement; Drama Adventure; Africa; Film Styles Ancient Rome; Africa; NAture; NaturE;

```

dann ist das sortierte Ergebnis (fast erwartungsgemäß)

```auto
"AfRICA; Africa; Drama Adventure; Drama World; Film Styles Ancient Rome; Instruments Solo Percussion; Natural World; Nature; NAture; NaturE; Nature Study; Percussion; Wildlife Movement

```

(richtig nett: $sort() und $dedup() in geschachtelter Anwendung ... man muss nur aufpassen, dass die Trennzeichen jeweils richtig angegeben werden)

```auto
$sort($dedup('AfRICA; Africa; Natural World; Nature Study; Nature; Drama Adventure; Drama World; Percussion; Instruments Solo Percussion; Wildlife Movement; Drama Adventure; Africa; Film Styles Ancient Rome; Africa; NAture; NaturE; ',;),;)

```

Führt zu

```auto
 ; Africa; Drama Adventure; Drama World; Film Styles Ancient Rome; Instruments Solo Percussion; Natural World; Nature; NAture; NaturE; Nature Study; Percussion; Wildlife Movement;AfRICA

```

---

<div class="post-metadata">

### Author: ![yorickausyps](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/y/f6c823/32.png) [@yorickausyps](https://community.mp3tag.de/u/yorickausyps)
#### Post date: [August 27, 2025, 2:58pm UTC](https://community.mp3tag.de/t/scripting-funktion-zum-loschen-doppelter-eintrage/69515/5 "2025-08-27T14:58:54Z")

</div>

Sehr schöne Sache, die neue Funktion zum Löschen doppelter Einträge!  
Bevor ich allerdings Änderungen an den Dateien vornehme, möchte ich immer erst mal wissen, wo doppelte Einträge sind und welche Dateien somit betroffen sind. Und auch das lässt sich mit Hilfe der neuen Funktion leicht herausfinden. Dazu dient mir der folgende Filter (F3), der im Tagfeld `composer` nach doppelten Namen sucht. Als Trennzeichen der Namen verwende ich hier ein Komma mit einem Leerzeichen dahinter.

```auto
"$if($strcmp($dedup(%composer%,', '),%composer%),yes,no)" IS no

```

Dann kann ich mich separat um die einzelnen Fundstellen kümmern und muss nicht tausende Dateien unnötig bearbeiten.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [September 3, 2025, 2:17pm UTC](https://community.mp3tag.de/t/scripting-funktion-zum-loschen-doppelter-eintrage/69515/6 "2025-09-03T14:17:55Z")

</div>

> [@Florian](#):
>
> Du könntest also schon jetzt diese Funktion (abgesehen von C für case-sensitive) ausprobieren

Der optionale Parameter C für case-sensitive ist nun mit [Mp3tag v3.31b](https://community.mp3tag.de/t/455) verfügbar (default ist case-sensitive).

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [October 3, 2025, 2:18pm UTC](https://community.mp3tag.de/t/scripting-funktion-zum-loschen-doppelter-eintrage/69515/7 "2025-10-03T14:18:03Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
