# Where can I learn more about "Format string" $loop $loopend() (%\_path%) $char(10),

**URL:** https://community.mp3tag.de/t/where-can-i-learn-more-about-format-string-loop-loopend-path-char-10/14473
**Category:** Support
**Created:** [February 20, 2013, 11:45pm UTC](https://community.mp3tag.de/t/where-can-i-learn-more-about-format-string-loop-loopend-path-char-10/14473 "2013-02-20T23:45:46Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![gwenkillerby](https://community.mp3tag.de/user_avatar/community.mp3tag.de/gwenkillerby/32/407_2.png) [@gwenkillerby](https://community.mp3tag.de/u/gwenkillerby)
#### Post date: [February 20, 2013, 11:45pm UTC](https://community.mp3tag.de/t/where-can-i-learn-more-about-format-string-loop-loopend-path-char-10/14473/1 "2013-02-20T23:45:46Z")

</div>

Field: LYRICS  
Format string:

$filename(C:\Documents and Settings\my\_majesty\Desktop\Backup.xls)ALBUM ARTIST COMMENT  
$loop(%\_path%)%album% %artist% $iflonger($replace(%comment%,$char(9),,$char(13)$char(10),**),32600,$left($replace(%comment%,$char(9),,$char(13)$char(10),),32600) !!! TOO LONG !!!,$replace(%comment%,$char(9),,$char(13)$char(10),))  
$loopend()**

---

<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 21, 2013, 6:58am UTC](https://community.mp3tag.de/t/where-can-i-learn-more-about-format-string-loop-loopend-path-char-10/14473/2 "2013-02-21T06:58:14Z")

</div>

I am not quite sure what you want to achieve.  
You mention the LYRICS field (which, AFAIK ist UNSYNCEDLYRICS in Mp3tag) but that field appears nowhere in that rather longish expression you call a format string.  
The syntax you offer is usually applied for exports (Menu File\>Export).

If you wonder about the $chr(10) (=Line feed) and $chr(13) (=carriage return): these are the (invisible) control characters in string of text to invoke a paragraph.  
So if you want the lyrics not just to be a single line but have linebreaks then you should insert these control characters.  
Unfortunately, for any data format like csv that relies on a single line for each record, the "paragraph" means "end of record". So you end up with just one line from the lyrics if you keep the paragraph. Instead you have to replace these control characters prior to export and after import.

---

<div class="post-metadata">

### Author: ![gwenkillerby](https://community.mp3tag.de/user_avatar/community.mp3tag.de/gwenkillerby/32/407_2.png) [@gwenkillerby](https://community.mp3tag.de/u/gwenkillerby)
#### Post date: [February 24, 2013, 2:53am UTC](https://community.mp3tag.de/t/where-can-i-learn-more-about-format-string-loop-loopend-path-char-10/14473/3 "2013-02-24T02:53:26Z")

</div>

Thank you anyway orhenkino for your time.

> [@](#):
>
> AFAIK ist UNSYNCEDLYRICS

Did you mean **isn't** or **ißt**?

What I want is simply to get the lyrics out of the uslt and into a textfile with the same name as the mp3.  
So, sorry for the confusion, but I don't need ONE csv file with all my lyrics, but I need many textfiles with the lyrics, one per song.

So correct me if I'm wrong, but isn't the export function able to do that?  
And please understand, until 4 days ago, I had no clue, _keine bläße schimmer_ what all these weird texts were, this

```
$loop(%_path%)%album% %artist% $iflonger($replace(%comment%,$char(9),<t>,$char(13)$char(10),$loopend(), no, NOT AT ALL.

```

But I am slowly getting it, it's a very configurable way do stuff to mp3 files, right?  
so, if I right clicked on a bunch of files, and clicked on **[Export...]**  
and then edited one of the Export configuration thingies into this: $filename(csv,ANSI)Title;Artist;UNSYNCEDLYRICS;

```
$loop$replace(%UNSYNCEDLYRICS%,$char(13)$char(10),'U+000DU+000A')
$loopend()build on %_date% with %_app%

```

then, I thought foolishly, it would export the content of the UNSYNCEDLYRICS field into a textfile, but it didn't.

this code does the following, I think:

- creates a csv-file, with the filename i've provided in the **[Export file name]** box, in the ANSI format.
- ln that file, the contents of 3 fields will be written: Title, Artist and UNSYNCEDLYRICS
- it then does the same thing for each selected files, that's the loop.
- it then ends the loop, and stores the file, with the filename i've provided in the **[Export file name]** box.

is that correct?

questions:

- How do I rewrite above code so that it really exports that?
- is a $ sign alway needed to identify a command?
- which are the possible commands?
- what is the syntax?
- are you already incredibly annoyed with me ? 😉

Line breaks are necessary, yes. because a search and replace is no prob if I had ONE file, but several thousands is boring.

anyways, Donkey-ßhown! 😉

---

<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 24, 2013, 9:21am UTC](https://community.mp3tag.de/t/where-can-i-learn-more-about-format-string-loop-loopend-path-char-10/14473/4 "2013-02-24T09:21:48Z")

</div>

Answers will come in bits.  
Part one.  
Exports end up in one file but you can split that file with a utility from this forum:  
[/t/14116/1](https://community.mp3tag.de/t/14116/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: [February 24, 2013, 9:31am UTC](https://community.mp3tag.de/t/where-can-i-learn-more-about-format-string-loop-loopend-path-char-10/14473/5 "2013-02-24T09:31:41Z")

</div>

QUOTE (GwenkillRRRRbeee @ Feb 24 2013, 04:53) \<{POST\_SNAPBACK}\>

... $filename(csv,ANSI)Title;Artist;UNSYNCEDLYRICS;

```
$loop$replace(%UNSYNCEDLYRICS%,$char(13)$char(10),'U+000DU+000A')
$loopend()build on %_date% with %_app%<!--QuoteEnd--></div><!--QuoteEEnd-->

```

this export creates a headline with the string "Title;Artist;UNSYNCEDLYRICS;" to help you identify which part of the following (looped) string is what. The number of %-enclosed fieldnames should match that headline.  
the $loop-Statement in your example takes the files as they are but ouputs only the edited %unsyncedlyrics% and no other field (which means that "title;artist" in the header is a little misleading)  
If you simply want to get the lyrics and no other information then reduce the report to  
$loop %unsyncedlyrics%$loopend()  
This then takes the lyrics from the file and does not remove any linefeeds and such things. The whole idea of replacing comes from the syntax of csv-files where data has to be in one line.

---

<div class="post-metadata">

### Author: ![gwenkillerby](https://community.mp3tag.de/user_avatar/community.mp3tag.de/gwenkillerby/32/407_2.png) [@gwenkillerby](https://community.mp3tag.de/u/gwenkillerby)
#### Post date: [February 27, 2013, 5:13pm UTC](https://community.mp3tag.de/t/where-can-i-learn-more-about-format-string-loop-loopend-path-char-10/14473/6 "2013-02-27T17:13:01Z")

</div>

Hi,

what you wrote above, got me an error of 'not enough loops' so I tried this export thingie:

```
$filename(artist-title-lyrics.txt,ANSI)$loop(%_path%)^
_ARTIST:''%_artist%''
_TITLE:''%_title%''
_UNSYNCEDLYRICS:''%_unsyncedlyrics%''
$regexp($regexp($regexp($list(,:'',''$char(13)_$char(10)),\r,U+000D),\n,U+000A),\r_\n,\r\n)$$

$loopend()

```

and that gave this as output! (which is more than I ever had)

```
^
_ARTIST:''
_TITLE:''
_UNSYNCEDLYRICS:''
ARTIST:'barry louis polisar'
_
ALBUMARTIST:'Various Artists'
_
COMMENT Comment:'19+7E78AF228C4E925B9C4C811C3C548AB2+10260828'
_
ENCODEDBY:'itunes v7.4.2'
_
TITLE:'all i want is you'
_
TRACK:'01'
_
UNSYNCEDLYRICS:'eng||If I was a flower growing wild and free

All I'd want is you to be my sweet honey bee.

And if I was a tree growing tall and greeen

All I'd want is you to shade me and be my leaves

'
_
$

^
_ARTIST:''
_TITLE:''
_UNSYNCEDLYRICS:''
ALBUM:'juno soundtrack'
_
ARTIST:'kimya dawson'
_
ALBUMARTIST:'kimya dawson'
_
GENRE:'soundtrack'
_
TITLE:'rollercoaster'
_
TRACK:'02'
_
UNSYNCEDLYRICS:'eng||you were on my mind at least nine tenths of yesterday

it seemed as if perhaps I'd gone insane

what is it about you that has commandeered my brain?

maybe it's your awesome songs or maybe it's the way

'
_
YEAR:'2007'
_
$

```

I've limited it to two songs, so you could see how that worked out. But .... we always want more, right? 😉

So could you help me with:  
1- NOT producing the ALBUM, the ALBUMARTIST, the GENRE and the TRACK fields?  
I don't know where they come from, i presume the regexp thingies, but I'd like for them to not be there.  
2- Also, how do i get rid of all the extra returns?

Vealen Dank! 😉

PS I kinda knew it wasn't a donkey!

pps  
somewhat related question, feel free to ignore it.:  
is this the default export configuration (or whatever the name is) for csv-files ?

```
$filename(New export file.txt,utf-8)
(Use the $filename command if you want to set the exported file default name and/or its encoding)

This is the header line of the export file

Use the loop(...) command do loop over specific fields of your files e.g.

$loop(%artist%)
    This part is shown for all different artists: %artist%
    You can even nest loops:
$loop(%album%)
    This will show the artists albums: %album%
    With its tracks:
$loop(%track%) %title%
$loopend()
$loopend()
$loopend()
Be sure to close the loops

This is the footer line - Have fun :)
```

---

<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 27, 2013, 8:05pm UTC](https://community.mp3tag.de/t/where-can-i-learn-more-about-format-string-loop-loopend-path-char-10/14473/7 "2013-02-27T20:05:45Z")

</div>

Now then, the code "thingie"

```
$filename(artist-title-lyrics.txt,ANSI)$loop(%_path%)^
_ARTIST:''%_artist%''
_TITLE:''%_title%''
_UNSYNCEDLYRICS:''%_unsyncedlyrics%''
$regexp($regexp($regexp($list(,:'',''$char(13)_$char(10)),\r,U+000D),\n,U+000A),\r_\n,\r\n)$$

$loopend()

```

only produces some decent output as you have the $list-statement in it.  
a line like

```
_ARTIST:''%_artist%''

```

produces only the introductory string plus the inverted commas as the variable %\_artist% will not contain anything unless you have created a user-defined field of that name. Your output examples show that you currently haven't.  
instead of the

```
$regexp($regexp($regexp($list(,:'',''$char(13)_$char(10)),\r,U+000D),\n,U+000A),\r_\n,\r\n)$$

```

(which has the $list statement in it which lists all fields and (accidently) also the UNSYNCEDLYRICS) can be replaced with a simple  
%unsyncedlyrics%

In the end the export "thingie" condenses to

```
$filename(artist-title-lyrics.txt,ANSI)$loop(%_path%)
%unsyncedlyrics%
$loopend()

```

The other question can simply answered with "no" as you have not included any "commas" - to get a "comma separated values" (=csv) file.  
If you insist on so many loops then the code should look like this to create a csv-file:

```
$filename(New export file.txt,utf-8)
$loop(%artist%)
$loop(%album%)
$loop(%track%)%artist%;%album%;%title%
$loopend()
$loopend()
$loopend()
```

---

<div class="post-metadata">

### Author: ![gwenkillerby](https://community.mp3tag.de/user_avatar/community.mp3tag.de/gwenkillerby/32/407_2.png) [@gwenkillerby](https://community.mp3tag.de/u/gwenkillerby)
#### Post date: [March 1, 2013, 12:29am UTC](https://community.mp3tag.de/t/where-can-i-learn-more-about-format-string-loop-loopend-path-char-10/14473/8 "2013-03-01T00:29:14Z")

</div>

Okay, wow, you kinda did it, thanks dude

Out of the two code thingies I managed to produce a third one, which really did what I wanted, or rather expected it to do. What I really want is to copy the lyrics between the USLT and the Lyrics3, but apparently, Lyrics is beyond the scope of whatever devs there _overhodet_ are.

```
$filename(artist-title-lyrics.txt,ANSI)$loop(%_path%)
$loop(%artist%)
$loop(%track%)%artist%;%title%;%unsyncedlyrics%
$loopend()
$loopend()
$loopend()

```

so, yes I used your

```
$filename(artist-title-lyrics.txt,ANSI)$loop(%_path%)
%unsyncedlyrics%
$loopend()

```

and your

```
$filename(New export file.txt,utf-8)
$loop(%artist%)
$loop(%album%)
$loop(%track%)%artist%;%album%;%title%
$loopend()
$loopend()
$loopend()

```

I don't know if it was your intention to make me do some things myself, anyways, that was the outcome.

the output of my code thingie is

> [@](#):
>
> **barry louis polisar** ;_all i want is you_;eng||If I was a flower growing wild and free  
> All I'd want is you to be my sweet honey bee.  
> And if I was a tree growing tall and greeen  
> All I'd want is you to shade me and be my leaves
> 
> **kimya dawson** ;_rollercoaster_;eng||you were on my mind at least nine tenths of yesterday  
> it seemed as if perhaps I'd gone insane  
> what is it about you that has commandeered my brain?  
> maybe it's your awesome songs or maybe it's the way  
> when I look at your face I can tell that you're  
> not going to be stopping soon or even slowing down

I can use that annoying **eng||** for some macro, I guess.

Sadly, competing program The Godfather seems to really have way to copy between the two lyrics fields, so this might all be pretty pointless, nevertheless, it was good exercise.

someday, perhaps, I will find a way to make mp3tag useful for something, I'm sure.

---

<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: [February 9, 2026, 12:24pm UTC](https://community.mp3tag.de/t/where-can-i-learn-more-about-format-string-loop-loopend-path-char-10/14473/9 "2026-02-09T12:24:21Z")

</div>


