Specifying the delimeter between tags on output

Started by calberga, April 27, 2025, 09:53:24 AM

Previous topic - Next topic

calberga

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?

StarGeek

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 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.

"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

calberga

#2
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!



greybeard

How about using -csv instead of -T (this also gives you the option of choosing a delimiter using -csvDelim)?

StarGeek

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/-T (-table) option.

Your only option is to either use the -csv option as @greybeard suggests, some other output format such as -j (-json)/-X (-xmlFormat), or create your own output format with the -p (-printFormat) option. 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?". This FAQ has suggestions on using the -p (-printFormat) option as well as other options.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

calberga

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.