ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: calberga on April 27, 2025, 09:53:24 AM

Title: Specifying the delimeter between tags on output
Post by: calberga on April 27, 2025, 09:53:24 AM
I am using exiftool to write a file with a list of tags from .mp3 files.  I want to split this into one file per tag, since running exiftool multiple time takes a lot of time.  However it turns out that some of the tags (at least "Comment") contain tab characters, which my splitting program (nor I myself) can distinguished from the tab characters separating tags.

Is there any way for me to specify a character to be used as the delimiter between tags on output?
Title: Re: Specifying the delimeter between tags on output
Post by: StarGeek on April 27, 2025, 10:12:38 AM
What is the exact command you are using? It's hard to tell you how to fix it if we don't know what you are doing.

As a general answer, the -api Filter option (https://exiftool.org/ExifTool.html#Filter) might be what you are looking for. If you add this to your command
-api "filter=s/\t/ /g"
then exiftool will replace all tab characters with spaces when outputting tag contents.

Title: Re: Specifying the delimeter between tags on output
Post by: calberga on April 27, 2025, 11:26:38 AM
First, I apologize for posting in the wrong place.

The command I am using is:

exiftool -charset cp1252 -charset filename=cp1252 -r -T -ext mp3 -directory -Filename -ID3v2_3:Title -ID3v2_3:Track -ID3v2_3:Artist -ID3v2_3:Album -ID3v2_3:Comment -ID3v2_3:Genre -ID3v2_3:Year -ID3v2_3:Compilation -ID3v2_3:Composer -ID3v2_3:Lyricist -ID3v2_3:Grouping -ID3v2_3:Subtitle -ID3v2_3:OriginalAlbum -ID3v2_3:Band -ID3v2_3:Conductor -ID3v2_3:InterpretedBy -ID3v2_3:PartOfSet -ID3v2_3:ISRC -ID3v2_3:OriginalFileName -F -L  "D:/M/Library/" > "D:/M/Current-Library-Tags/AllCurrentTags.txt"

I inserted the -api argument into this, before the -r.  The result was still tab-delimited.  I guess I wasn't clear enough, it is the character separating the tag values which I wish to change of another character, in this case ยค. It is not the tab characters in the tag value which I wish to change.

I delved into the page https://exiftool.org/ExifTool.html#Options but not being conversant with the programing language used I could not follow the examples.  At 90 years I am still happy to have a LISP system on windows and don't want to take time to learn a new (to me) language.  I guess I need to find a .csv parser in Common LISP!


Title: Re: Specifying the delimeter between tags on output
Post by: greybeard on April 27, 2025, 12:13:50 PM
How about using -csv instead of -T (this also gives you the option of choosing a delimiter using -csvDelim)?
Title: Re: Specifying the delimeter between tags on output
Post by: StarGeek on April 27, 2025, 12:32:11 PM
Quote from: calberga on April 27, 2025, 11:26:38 AMI inserted the -api argument into this, before the -r.  The result was still tab-delimited.

Yes. The option I gave was so you could continue using tabs as delimiters. There is no option to change the delimiter in the -t (-tab) option (https://exiftool.org/exiftool_pod.html#t--tab)/-T (-table) option (https://exiftool.org/exiftool_pod.html#T--table).

Your only option is to either use the -csv option (https://exiftool.org/exiftool_pod.html#csv-CSVFILE) as @greybeard suggests, some other output format such as -j (-json) (https://exiftool.org/exiftool_pod.html#j-JSONFILE--json)/-X (-xmlFormat) (https://exiftool.org/exiftool_pod.html#X--xmlFormat), or create your own output format with the -p (-printFormat) option (https://exiftool.org/exiftool_pod.html#p-FMTFILE-or-STR--printFormat). Note that the latter is best used when you have a set of tags you want to extract, not all tags. This seems to be the case in your command.

See FAQ #12 "How do I export information from exiftool to a database?" (https://exiftool.org/faq.html#Q12). This FAQ has suggestions on using the -p (-printFormat) option as well as other options.
Title: Re: Specifying the delimeter between tags on output
Post by: calberga on April 27, 2025, 05:50:26 PM
I thought I replied earlier, sorry for the delay.

Thank you for the help!  It all works.  It even lets me specify a file with extension .txt so it gets directed to my favorite vintage editor.