ExifTool Forum

ExifTool => Archives => Topic started by: Archive on May 12, 2010, 08:54:13 AM

Title: xmp:subject -how to distinguish separate keywords?
Post by: Archive on May 12, 2010, 08:54:13 AM
[Originally posted by bogdan on 2007-12-23 09:15:32-08]

Hi,

Assume, inside xmp:subject, we have following keywords:

"one"

"two, three" -such "mistakes" happen

"four"

If I use:

exiftool -xmp:subject image.jpg

-I get/see:

Subject: one, two, three, four

And attempt to delete:

exiftool -xmp:subject-="two" image.jpg

-will, of course, fail (without "obvious" reason).

I guess, you get the point: How can I tell, "two, three" is a single keyword? Is there a possibility I can force exiftool to use another keyword delimiter -so I could get (for example):

Subject: one; two, three; four

Greetings,

Bogdan
Title: Re: xmp:subject -how to distinguish separate keywords?
Post by: Archive on May 12, 2010, 08:54:13 AM
[Originally posted by exiftool on 2007-12-23 13:40:58-08]

When you use the -b option to extract a list-type tag, it will insert newlines between the values instead of the standard comma delimiters.  I hope this is sufficient for you.  I realize the problem, but I try to avoid adding more exiftool command-line options if at all possible (it is already far too complex for the average user).

- Phil
Title: Re: xmp:subject -how to distinguish separate keywords?
Post by: Archive on May 12, 2010, 08:54:13 AM
[Originally posted by bogdan on 2007-12-23 14:37:39-08]

This will do the job, I believe -thanks.

And you are very right about (too) many options... speaking for me, it's hard to remember all those combinations. Actually, I've started writing my own "how to" notices from this forum.

Now, I'll use oportunity for another question: How to tell, if some keyword allready exist inside xmp:subject?

For example, there's allready "stiri" keyword there. Now I wish to add "tir" keyword, but only if "tir" is not already there (notice, "tir" occur inside "stiri").

I've tried with various combinations of (from this forum):

exiftool -xmp:subject+=tir -if "not $xmp:subject=~/tir/" photo.jpg

exiftool -xmp:subject+=tir -if (not $xmp:subject eq "tir") photo.jpg

...etc. -without success.
 

What I need is exact match. I don't need to tell you, I don't know what exactly "tag=~/xxx/" does. I saw somewhere in this forum, something like "tag=!/..." was used. Where can I find more examples of using "-if"?

Btw. In Windows, how do I use (nested) guotes for:

exiftool -ApertureValue -if '$Make eq "Canon"' *.jpg

Now, I'll shut up :-)

Bogdan
Title: Re: xmp:subject -how to distinguish separate keywords?
Post by: Archive on May 12, 2010, 08:54:13 AM
[Originally posted by bogdan on 2007-12-23 16:10:10-08]

Meanwhile, I've visited some perl pages... can't say I'm now more clever than before:-)

Anyway:

exiftool -FileName -if "$Make eq 'Canon'" *.jpg

-does work. But:

exiftool -FileName -if "$xmp:subject eq 'Canon'" *.jpg

-doesn't (even "Canon" is inside xmp:subject).

Thanks for reading,

Bogdan
Title: Re: xmp:subject -how to distinguish separate keywords?
Post by: Archive on May 12, 2010, 08:54:13 AM
[Originally posted by exiftool on 2007-12-23 17:59:43-08]

Hi Bogdan,

"$tag=~/xxx/" is a Perl regular express that evaluates to true if
the string "xxx" is inside the value of tag.  This is different than
"eq" which tests for string equality.

You can use $tag=~/\btir\b/.  The \b in a regular expression represents
a word boundary, so with this addition strings like "stiri" won't match.

In Windows, the outside quotes must be double.  So use this:

exiftool -ApertureValue -if "$make eq 'Canon'" *.jpg

- Phil