IPTC-metadata; How to delete only a part of the by-line tag?

Started by stephanie, November 22, 2016, 08:08:12 AM

Previous topic - Next topic

stephanie

Hello to all & special to Phil,

I have to create a photoarchiv with more than 1000 jpegs which need to be categorized an marked via IPTC-metadata. I am using ExifToolGui (ExifTool direct) which is a great help in my daily work. My problem is:

I have By-line tags as the following:
"Mr. X 12345"
"Mrs. Y 12345"
"Mr. D 12345"
"Mr. T 12345"
And so on...

But I only want to have the name of the author(s) (eg. Mr. X) into the by-line tag. Therefore I want to delete the useless rest of the tag (always "12345").

Which is the correct code to realize this?
I thought about any command like "-By-line-=12345"

Could anybody give me a hint?

Many greetings from

Stephanie

Phil Harvey

Hi Stephanie,

There are a few ways to do this.  Here is one:

exiftool -tagsfromfile @ -by-line -api filter="s/ \d+$//" DIR

This will remove a space followed by any combination of digits from the end of each By-Line entry.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

stephanie

Hello Phil,

Now it works!
Thank you very much!

Does a similar command exist to delete letters instead of digits?

e.g. my By-line tags look like:
"Mr. X KLM"
"Mrs. Y KLM"
"Mr. D KLM"
"Mr. T KLM"
...


Many greetings from

Stephanie

Phil Harvey

Hi Stephanie,

Yes, but you have to be careful not to delete a name if you're deleting the last word:

exiftool -tagsfromfile @ -by-line -api filter="s/ [^ ]*$//" DIR

This will delete the last word regardless of whether it is numbers, letters, symbols or a combination.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

stephanie

Hello Phil,

Perfect! :D
You saved me from changing about 500 by-line tags by hand.

Thank you so much!

Stephanie