# Is there a quick and dirty way to replace all ARTIST tags with what's in the ALBUMARTIST field?

**URL:** <https://discourse.beets.io/t/is-there-a-quick-and-dirty-way-to-replace-all-artist-tags-with-whats-in-the-albumartist-field/1886>\
**Category:** Help\
**Created:** [September 29, 2021, 7:24pm UTC](https://discourse.beets.io/t/is-there-a-quick-and-dirty-way-to-replace-all-artist-tags-with-whats-in-the-albumartist-field/1886 "2021-09-29T19:24:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![apastuszak](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@apastuszak](https://discourse.beets.io/u/apastuszak)\
**Post date:** [September 29, 2021, 7:24pm UTC](https://discourse.beets.io/t/is-there-a-quick-and-dirty-way-to-replace-all-artist-tags-with-whats-in-the-albumartist-field/1886/1 "2021-09-29T19:24:02Z")

</div>

The title says it all. I need to dump all my music to a device that doesn’t support the ALBUMARTIST tag.

I’m sure I can write a python script to do it using mutagen, but if beets has some way to do it, I would love to go that route.

---

<div class="post-metadata">

**Author:** ![jackwilsdon](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/jackwilsdon/32/10_2.png) [@jackwilsdon](https://discourse.beets.io/u/jackwilsdon)\
**Post date:** [September 29, 2021, 7:38pm UTC](https://discourse.beets.io/t/is-there-a-quick-and-dirty-way-to-replace-all-artist-tags-with-whats-in-the-albumartist-field/1886/2 "2021-09-29T19:38:01Z")

</div>

beets doesn’t yet support [formatted modify](https://github.com/beetbox/beets/issues/488), so your best bet is probably to [write a beets plugin](https://beets.readthedocs.io/en/stable/dev/plugins.html).

---

<div class="post-metadata">

**Author:** ![ctrueden](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/ctrueden/32/475_2.png) [@ctrueden](https://discourse.beets.io/u/ctrueden)\
**Post date:** [September 30, 2021, 3:30pm UTC](https://discourse.beets.io/t/is-there-a-quick-and-dirty-way-to-replace-all-artist-tags-with-whats-in-the-albumartist-field/1886/3 "2021-09-30T15:30:32Z")

</div>

@apastuszak Here is a shell script that writes the albumartist value into the artist field for every track in your collection:

```auto
beet ls -f '$path :: $albumartist' | while read line
do
safeline=$(echo "$line" | sed "s/'/'\\\\''/g") # escape single quote marks
p=${safeline% :: *}
albumartist=${safeline#* :: }
test "$albumartist" &&
  echo "beet modify path:'$p' artist='$albumartist'" ||
  echo "[WARNING] No albumartist for track: ${line% :: *}"
done

```

Well, it doesn’t actually write anything… rather, it generates `beet` commands to do it track by track, so that you can review the results before actually doing it. So it should be safe to cut-and-paste and play around with, without nuking anything.

---

<div class="post-metadata">

**Author:** ![apastuszak](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@apastuszak](https://discourse.beets.io/u/apastuszak)\
**Post date:** [September 30, 2021, 3:41pm UTC](https://discourse.beets.io/t/is-there-a-quick-and-dirty-way-to-replace-all-artist-tags-with-whats-in-the-albumartist-field/1886/4 "2021-09-30T15:41:49Z")

</div>

Thanks! This is going to save me a lot of time.
