# Strip total disc number from discnumber field

**URL:** https://community.mp3tag.de/t/strip-total-disc-number-from-discnumber-field/12163
**Category:** Support
**Created:** [June 17, 2011, 11:36pm UTC](https://community.mp3tag.de/t/strip-total-disc-number-from-discnumber-field/12163 "2011-06-17T23:36:41Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Data1001](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/e274bd/32.png) [@Data1001](https://community.mp3tag.de/u/Data1001)
#### Post date: [June 17, 2011, 11:36pm UTC](https://community.mp3tag.de/t/strip-total-disc-number-from-discnumber-field/12163/1 "2011-06-17T23:36:41Z")

</div>

This seems like it should be a simple thing to do, but I searched for about 15 minutes on the forum and didn't see this mentioned in any of the posts, so -- here we go... ![:unsure:](https://community.mp3tag.de/uploads/default/original/1X/cfaeba84fe6704387c5b34dfdd8172bd51b6f533.gif ":unsure:")

I have quite a number of MP3's which have the disc number formatted as x/x (that is, 1/4, 2/4, 3/4, 4/4 -- instead of simply 1, 2, 3, 4). What I want to do is remove the "/x" (the total disc number listed in the field), so that it only displays that particular disc number.

Anyone know of an action that will take care of this?

I also wouldn't mind something that would do something similar in the track number field (i.e., strip the total tracks from that field, leaving only each individual track number behind).

Like I said, I figure this must be a simple thing, but I'm not very knowledgeable in how to accomplish the task. 😳

Thanks in advance for any assistance! 🙂

---

<div class="post-metadata">

### Author: ![JJ\_Johnson](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jj_johnson/32/67_2.png) [@JJ\_Johnson](https://community.mp3tag.de/u/JJ_Johnson)
#### Post date: [June 17, 2011, 11:44pm UTC](https://community.mp3tag.de/t/strip-total-disc-number-from-discnumber-field/12163/2 "2011-06-17T23:44:59Z")

</div>

The simplest way may be to use the $fmtNum() function. I use it on the track number field.

_Action type:_ **Format value**  
_Field:_ **DISCNUMBER**  
_Format string:_ **$fmtNum(%discnumber%)**

_Action type:_ **Format value**  
_Field:_ **TRACK**  
_Format string:_ **$fmtNum(%track%)**

---

<div class="post-metadata">

### Author: ![Data1001](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/e274bd/32.png) [@Data1001](https://community.mp3tag.de/u/Data1001)
#### Post date: [June 18, 2011, 12:10am UTC](https://community.mp3tag.de/t/strip-total-disc-number-from-discnumber-field/12163/3 "2011-06-18T00:10:16Z")

</div>

Whoo-hoo! Works like a charm. (I have no idea how or why it works, but I don't care! 😃 )

Thanks so much, JJ. 🕶

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [June 18, 2011, 1:09am UTC](https://community.mp3tag.de/t/strip-total-disc-number-from-discnumber-field/12163/4 "2011-06-18T01:09:34Z")

</div>

You can also use the function $num() to do the same.  
For example ... **$num(%discnumber%,1)**

This works for all strings with a leading number and following any non-digit character ... e. g.  
$num('123abc456',1) ==\> 123  
$num('123abc456',2) ==\> 123  
$num('123abc456',3) ==\> 123  
$num('123abc456',4) ==\> 0123  
$num('123abc456',5) ==\> 00123

DD.20110618.0510.CEST  
Edit.20120506.1435.CEST

---

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [June 18, 2011, 2:36pm UTC](https://community.mp3tag.de/t/strip-total-disc-number-from-discnumber-field/12163/5 "2011-06-18T14:36:08Z")

</div>

> [@DetlevD](#):
>
> You can also use the function $num() to do the same.  
> For example ... **$num(%discnumber%,1)**
> 
> DD.20110618.0510.CEST

Another way to skin a cat!!

_Name of action group:_ **&Remove#Total No. Of &Disks**

_Action type:_ **Replace with regular expression**  
_Field:_ **DISCNUMBER**  
_Regular expression:_ **^(\d+)/\d+**  
_Replace matches with:_ **$1**

[] case-sensitive comparison

---

<div class="post-metadata">

### Author: ![Data1001](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/e274bd/32.png) [@Data1001](https://community.mp3tag.de/u/Data1001)
#### Post date: [June 19, 2011, 1:30am UTC](https://community.mp3tag.de/t/strip-total-disc-number-from-discnumber-field/12163/6 "2011-06-19T01:30:26Z")

</div>

_See, I knew this would be a walk in the park for the resident geniuses here. However, I have a followup which, I'd guess, may be slightly more complex. 😉_

After I posted that original query, a related question popped into my head, and as long as it's sort of germane, I figured I may as well posit that one in this thread, as well...

In my initial wandering through the forum looking for an answer to my issue above, I came across a few people mentioning an extended tag called either TOTALDISCS or DISCTOTAL. So I wondered if there was a way to **1)** strip that total disc number from the DISCNUMBER field, and at the same time **2)** write that same number to this extended tag/field (total # of discs). Because I can see where it'd be handy to keep that info (on the total number of discs), but not have to "dirty up" the DISCNUMBER tag with extraneous info.

(And then, of course -- not being sensible to leave well enough alone -- I was curious as to whether there was a similar extended tag in regards to tracks, i.e., TOTALTRACKS or TRACKTOTAL -- and if so, how a similar feat might be accomplished.)

Apologies if this is considered "hijacking my own thread". It's just that I'm always about finding shortcuts and making things more efficient, even if I don't exactly know how to do it myself. 😃

Muchas gracias!

---

<div class="post-metadata">

### Author: ![JJ\_Johnson](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jj_johnson/32/67_2.png) [@JJ\_Johnson](https://community.mp3tag.de/u/JJ_Johnson)
#### Post date: [June 19, 2011, 2:04am UTC](https://community.mp3tag.de/t/strip-total-disc-number-from-discnumber-field/12163/7 "2011-06-19T02:04:16Z")

</div>

The actual field names used for total tracks and total discs are somewhat application dependent. There really isn't an accepted standard, so it's best to find out what your favorite music program uses. You could even write the values to multiple fields, although that can sometimes be difficult to maintain.

There are a number of ways to separate the values. Assuming that all of your discnumber fields have that same x/y structure that you showed in your first post, I would do it like this:

Action #1  
_Action type:_ **Guess values**  
_Source format:_ **%discnumber%**  
_Guessing pattern:_ **%discnumber%/%totaldiscs%**

Action #2  
_Action type:_ **Format value**  
_Field:_ **DISCNUMBER**  
_Format string:_ **$fmtNum(%discnumber%)**

Action #3  
_Action type:_ **Format value**  
_Field:_ **TOTALDISCS**  
_Format string:_ **$fmtNum(%totaldiscs%)**

Actions #2 and #3 aren't strictly necessary, but I would include them just in case, to clean up any unwanted characters such as spaces or leading zeroes that might have been in the original.

Repeat the above for TRACK and TOTALTRACKS (or TRACKTOTAL).

---

<div class="post-metadata">

### Author: ![dweeb](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/4491bb/32.png) [@dweeb](https://community.mp3tag.de/u/dweeb)
#### Post date: [June 3, 2019, 8:08am UTC](https://community.mp3tag.de/t/strip-total-disc-number-from-discnumber-field/12163/8 "2019-06-03T08:08:53Z")

</div>

The original post of how to change disc number 1/4, 2/4, 3/4, 4/4 to 1,2,3,4

As a Basic, TurboBasic, & Pascal programmer, I revert back to the basics, and used:

FORMAT VALUE  
Field: DISCNUMBER  
Format String: $left(%discnumber%,1)

Which changes the DISCNUMBER field, to be whatever is in the leftmost digit, of the current DISCNUMBER field. If the field is empty, it stays empty.

This only works up to 9/9 to 9. At 10/10 something else would be needed.

---

<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: [June 3, 2019, 8:14am UTC](https://community.mp3tag.de/t/strip-total-disc-number-from-discnumber-field/12163/9 "2019-06-03T08:14:40Z")

</div>

Or use:  
FORMAT VALUE  
Field: DISCNUMBER  
Format String: $num(%discnumber%,1)

This skips anything non-numeral, so everything foloowing the slash.

---

<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: [February 2, 2025, 9:10pm UTC](https://community.mp3tag.de/t/strip-total-disc-number-from-discnumber-field/12163/10 "2025-02-02T21:10:13Z")

</div>

A post was split to a new topic: [Find number of total discs from single discnumber](https://community.mp3tag.de/t/find-number-of-total-discs-from-single-discnumber/67371)

---

<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: [February 2, 2025, 9:12pm UTC](https://community.mp3tag.de/t/strip-total-disc-number-from-discnumber-field/12163/11 "2025-02-02T21:12:27Z")

</div>


