# Remove duplicate tags if values are equal

**URL:** <https://community.mp3tag.de/t/remove-duplicate-tags-if-values-are-equal/52247>\
**Category:** Support\
**Created:** [March 5, 2021, 9:19am UTC](https://community.mp3tag.de/t/remove-duplicate-tags-if-values-are-equal/52247 "2021-03-05T09:19:13Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sonymaster](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@sonymaster](https://community.mp3tag.de/u/sonymaster)\
**Post date:** [March 5, 2021, 9:19am UTC](https://community.mp3tag.de/t/remove-duplicate-tags-if-values-are-equal/52247/1 "2021-03-05T09:19:13Z")

</div>

Hi experts,  
many of my files have multiple tags with the same value. For example two YEAR tags with the same value of 2009.  
I've tried to remove those duplicate tags with the quick action, but it removes all duplicate tags, independently of the value. So I would lost information.

Is it possible to remove duplicate tags only when the values are equal?

---

<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:** [March 5, 2021, 10:42am UTC](https://community.mp3tag.de/t/remove-duplicate-tags-if-values-are-equal/52247/2 "2021-03-05T10:42:31Z")

</div>

Try  
`"$if($eql($meta(year,0),$meta(year,1)),1,0)" IS "1"`  
Select the files,  
Delete the superfluous YEAR field with the extended tags dialogue.

---

<div class="post-metadata">

**Author:** ![sonymaster](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@sonymaster](https://community.mp3tag.de/u/sonymaster)\
**Post date:** [March 5, 2021, 12:55pm UTC](https://community.mp3tag.de/t/remove-duplicate-tags-if-values-are-equal/52247/3 "2021-03-05T12:55:06Z")

</div>

It works!

Many thanks

---

<div class="post-metadata">

**Author:** ![globalnomad](https://community.mp3tag.de/user_avatar/community.mp3tag.de/globalnomad/32/9702_2.png) [@globalnomad](https://community.mp3tag.de/u/globalnomad)\
**Post date:** [August 28, 2021, 3:39pm UTC](https://community.mp3tag.de/t/remove-duplicate-tags-if-values-are-equal/52247/4 "2021-08-28T15:39:50Z")

</div>

Sorry to drag this back up, but after I used your super helpful filter code, I don't see duplicate ALBUMARTIST fields when I open extended tags for multiple files from different artists - just one.  
 ![nodup](https://community.mp3tag.de/uploads/default/original/2X/4/4232bbdc9c07454ee06f8d95e531accee0a8e83c.png)

If I delete it then both get deleted. Should I be approaching this a different way? I've tried a Merge action script, but it's not working either:  
 ![aa](https://community.mp3tag.de/uploads/default/original/2X/8/8ee6073ac987d77d9e060065d5dfbe071e18eacb.png)

I'll be honest, I don't know the origins of this script as it's been on my mp3tag installation for years now and I'm only coming back to mp3tag after updating.

---

<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 29, 2021, 7:45am UTC](https://community.mp3tag.de/t/remove-duplicate-tags-if-values-are-equal/52247/5 "2021-08-29T07:45:00Z")

</div>

> [@globalnomad](#):
>
> If I delete it then both get deleted. Should I be approaching this a different way? I've tried a Merge action script, but it's not working either:

I do not see a merge script in the dump - it is a split action.  
I would really use thee action [Merge duplicate fields](https://docs.mp3tag.de/actions/merge-duplicate-fields) and use e.g. == as field separator.  
Then use an action of the type "Replace with regular expression" for e.g. ALBUMARTIST  
Search string: `(.*)==.*`  
Replace string: $1  
All this in the filtered list

---

<div class="post-metadata">

**Author:** ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)\
**Post date:** [August 29, 2021, 3:57pm UTC](https://community.mp3tag.de/t/remove-duplicate-tags-if-values-are-equal/52247/6 "2021-08-29T15:57:04Z")

</div>

> [@globalnomad](#):
>
> Sorry to drag this back up, but after I used your super helpful filter code, I don't see duplicate ALBUMARTIST fields when I open extended tags for multiple files from different artists - just one.

What exactly does your filter look like?

---

<div class="post-metadata">

**Author:** ![globalnomad](https://community.mp3tag.de/user_avatar/community.mp3tag.de/globalnomad/32/9702_2.png) [@globalnomad](https://community.mp3tag.de/u/globalnomad)\
**Post date:** [August 30, 2021, 12:38am UTC](https://community.mp3tag.de/t/remove-duplicate-tags-if-values-are-equal/52247/7 "2021-08-30T00:38:59Z")

</div>

`"$if($and(NOT %albumartist% IS '', $if($eql($meta(albumartist,0),$meta(albumartist,1)),1,0) IS 1),1,0)" IS "1"`

The filter works fine, it's just the originally suggested method of fixing them doesn't work when trying to batch remove the duplicates.

---

<div class="post-metadata">

**Author:** ![globalnomad](https://community.mp3tag.de/user_avatar/community.mp3tag.de/globalnomad/32/9702_2.png) [@globalnomad](https://community.mp3tag.de/u/globalnomad)\
**Post date:** [August 30, 2021, 12:42am UTC](https://community.mp3tag.de/t/remove-duplicate-tags-if-values-are-equal/52247/8 "2021-08-30T00:42:46Z")

</div>

Thanks for the help! Worked like a charm.

---

<div class="post-metadata">

**Author:** ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)\
**Post date:** [September 26, 2022, 5:58am UTC](https://community.mp3tag.de/t/remove-duplicate-tags-if-values-are-equal/52247/9 "2022-09-26T05:58:24Z")

</div>

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