I'm seeing that when no duplicates exist then NoDups(1) deletes all entries in the list:
exiftool -keywords a.jpg
Keywords : Arctic, Norway, Spitsbergen, Svalbard, bears, ice, mammal, pack ice, polar bear, snow
exiftool -m -q -sep '##' '-keywords<${keywords;NoDups(1)}' a.jpg
exiftool -keywords a.jpg
Keywords :
When there is at least one duplicate the command works as expected.
macOS: 10.15.5
exiftool -ver: 11.85
From the docs on the -m (ignoreMinorErrors) option (https://exiftool.org/exiftool_pod.html#m--ignoreMinorErrors)
Note that this causes missing values in -tagsFromFile, -p and -if strings to be set to an empty string rather than an undefined value.
'-keywords<keywords' is an implied -TagsFromFile and when -m is added, the NoDups(1) will be set to a blank string instead of undefined. Remove it and the command will do what you want.
Teach me to read the fine print in the docs!
Thanks
Hello everybody,
sorry to give my 2 cents to this problem.
But I have seen that the tag is not deleted, but an empty list is created/written.
Should the listtype-tag be deleted?
Best regards
herb
I'm not sure I follow. Do you have an example command and tag data?
Hello StarGeek,
sorry, that I was not clear enough.
In first post of this topic, msbc gives a good example. The output of his display-command shows that keywords exists and that keywords is empty.
I had expected that keywords is deleted (does not exist) after "NoDups(1)" command.
Best regards
herb
Normally, NoDups(1) would return Undef in the event there were not any duplicates. That way the file wouldn't be rewritten if there wasn't a change. But because of the -m (ignoreMinorErrors) option (https://exiftool.org/exiftool_pod.html#m--ignoreMinorErrors), it won't return undefined, it returns an empty string, which now overwrites the original keywords.
Hello StarGeek,
thanks for your detailed explanation. It is all understood.
Usuallay -keywords= (which is -keywords=<empty string returned by NoDups(1)> will remove the keywords tag, so that it does not exists anymore.
But why does it exist afterwards as "an empty listtype tag" ?
Best regards
herb
Writing an empty string to any tag will do this. The confusion arises because ExifTool uses the -TAG= syntax to indicate that you want to delete the tag. So it is actually very difficult to write an empty string from the command line. (That is why I added the -TAG^= syntax.) But using -m with an advanced formatting expression that returns undef (or just an expression that returns an empty string) is one way to do it.
- Phil
Hello Phil,
thanks for your detailed description.
Best regards
herb