ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: lemonish on November 06, 2024, 09:57:17 AM

Title: Question on How to Swap Characters
Post by: lemonish on November 06, 2024, 09:57:17 AM
Hello everyone, forgive me as I'm not really good at this. Tried to search all over the net but couldn't find the solution.


I'm wondering how to get from this:-
Keywords:  "food,beach,ocean,sea,water,lunch,meal"

to this:
Keywords:   food; beach; ocean; sea; water; lunch; meal


Many many thanks in advance.
Title: Re: Question on How to Swap Characters
Post by: StarGeek on November 06, 2024, 10:12:42 AM
If all you want to do is change the exiftool output, then you would use the -sep option (https://exiftool.org/exiftool_pod.html#sep-STR--separator)
C:\>exiftool -G1 -a -s -keywords y:\!temp\Test4.jpg
[IPTC]          Keywords                        : food, beach, ocean, sea, water, lunch, meal

C:\>exiftool -G1 -a -s -sep ; -keywords y:\!temp\Test4.jpg
[IPTC]          Keywords                        : food;beach;ocean;sea;water;lunch;meal

But this doesn't change the data in the file, nor should it. That is because keywords is a List type tag. The data isn't saved a simple string the contains all the entries like this
"food,beach,ocean,sea,water,lunch,meal"

Instead, List type tags are tags which are saved in the file as individual separate entries.  While many programs will display them as comma/semicolon separated, they are not.  Each entry is completely self-contained and separate from the others.

Using the XMP:Subject tag as an example, here's how the data is saved in the file
<dc:subject>
 <rdf:Bag>
  <rdf:li>keyword 1</rdf:li>
  <rdf:li>keyword 2</rdf:li>
  <rdf:li>keyword , with comma</rdf:li>
 </rdf:Bag>
</dc:subject>


See FAQ #17, List-type tags (https://exiftool.org/faq.html#Q17)