ExifTool Forum

ExifTool => Newbies => Topic started by: cheshyre on January 20, 2017, 02:47:28 PM

Title: Filtering tags by language/locale when reading
Post by: cheshyre on January 20, 2017, 02:47:28 PM
I've been extracting the metadata from font files.

Many of them have multiple locale-specific tags.
For example, a file may contain all of the following:
I'd like to extract ONLY tags which are English (-en*) or which have NO locale specified.

Is there an easy way to do this in the command line?
My unfamiliarity with the terminology may have gotten in the way of finding the answer in the docs.

Thanks in advance for assistance, and thanks for such a marvelous tool!
Title: Re: Filtering tags by language/locale when reading
Post by: Phil Harvey on January 20, 2017, 03:39:02 PM
Typically there will be a default language version of the tag which is english.  In your example, do you want to extract both Description and Description-en-US, or one or the other?

Extracting only a specific language is easy, but it sounds like you want to do something more complex, which may be difficult.

- Phil
Title: Re: Filtering tags by language/locale when reading
Post by: cheshyre on January 21, 2017, 01:45:01 PM
Yes, I'd like to extract BOTH Description and Description-en-US (and likewise for all the other tags).
However, if it's easier to extract one OR the other, then I'll take the instructions for that.
I can always run the command twice, once for each locale, and just append the results.
Title: Re: Filtering tags by language/locale when reading
Post by: Phil Harvey on January 21, 2017, 02:52:47 PM
OK, how about this?:

exiftool "--*-??" -execute "-*-en-US" -common_args FILE

This command runs exiftool twice on the file.  The first time it extracts all tags without except alternate language tags, and the second pass extracts all "en-US" tags.

- Phil