Remove a period from a set of captions?

Started by Archive, May 12, 2010, 08:54:34 AM

Previous topic - Next topic

Archive

[Originally posted by bceugene on 2009-04-08 18:51:20-07]

Hi Phil, this is probably a pie in the sky, but I have a group of 2,500 dng files where I inadvertently typed a period at the end of every caption (IPTC) and would like to remove it. Any thoughts? In almost all of them it is the only period in the string of text.

Thanks,
Brett

Archive

[Originally posted by exiftool on 2009-04-08 22:08:58-07]

This is easy to do with a user-defined composite tag
and a command line like this:

Code:
exiftool "-caption-abstract<mycaption" DIR

Read the config file documentation for more information
on user-defined tags.  A ValueConv to do this could look
like this:

Code:
        ValueConv => '$val =~ s/\.$// ? $val : undef',

This will return a value only if a "." is removed as the last
character of the value, otherwise it returns undef.  This
prevents rewriting any files which don't have captions ending
in a ".".

- Phil

Archive

[Originally posted by bceugene on 2009-04-08 22:57:16-07]

Thanks a lot Phil, I will take a crack at it. I really have zero clue what I'm doing with any of this so if you feel so inclined it would be great to see how it would be written for a sample scenario, for example for a series of dng files residing in k:/photos/test

Thanks also for your earlier help in getting me going with the copying of captions across sets of similarly named files. It's been enormously helpful now that I have it going, a real life saver.

Brett

Archive

[Originally posted by exiftool on 2009-04-09 10:52:08-07]

Hi Brett,

The full ".ExifTool_config" file looks like this:

Code:
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        MyCaption => {
            Require => 'Caption-Abstract',
            ValueConv => '$val =~ s/\.$// ? $val : undef',
        },
    },
);

The command line looks like this:

Code:
exiftool "-caption-abstract<mycaption" k:/photos/test

- Phil

Archive

[Originally posted by exiftool on 2009-04-09 11:37:58-07]

Also, if you need more reading material, here
are a few related threads in this forum:

http://www.cpanforum.com/threads/7366" target="_blank">removing date in caption text

http://www.cpanforum.com/threads/6900" target="_blank">remove line break from caption in JPG IPTC and XMP

http://www.cpanforum.com/threads/10158" target="_blank">Search and replace in keywords...

- Phil