Main Menu

Append within tag

Started by Matthx, January 12, 2021, 09:23:39 AM

Previous topic - Next topic

Matthx

Hello,

I understand I can append text to a field using exiftool, however is it possible to append text at a certain point in a field.

For instance, the caption field reads:

CARDIFF, WALES - MARCH 1: XXX March 1, 2020, in Cardiff, Wales.

And I would like to insert text at the point where XXX is

I initially thought it might be possible to 'offset' the start to account for the characters before (city and date) but this text will change from picture to picture.

Is there possibly a way of substituting matched text?

Thanks in advance,

Matt

StarGeek

This can be done with the Advanced formatting feature, which is basically just a bit of Perl code inside the tag name.  It is most commonly done with a RegEx (Regular Expression) substitution.  There is this example in the docs and it is one of the most common questions on this forum.  You can find more examples with this Google search.

Using your example your command would be along these lines
exiftool "-Description<${Description;s/: XXX/: new word XXX/}" file.jpg
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Matthx

That is incredibly helpful. Thank you!