ExifTool Forum

ExifTool => Archives => Topic started by: Archive on May 12, 2010, 08:54:17 AM

Title: removing date in caption text
Post by: Archive on May 12, 2010, 08:54:17 AM
[Originally posted by jofr on 2008-03-16 15:34:52-07]

Hi,
I'm trying to remove a date in the caption text.
The only thing I know is that it looks like this often:
"06.02.2008 Euro 2008 Vorbereitung Oesterreich ...."

So I could search for ".2008" and then remove this and 5 characters in front of it.
But how do I do this within an .ExifTool_config file?

Thanks,
JO
Title: Re: removing date in caption text
Post by: Archive on May 12, 2010, 08:54:17 AM
[Originally posted by exiftool on 2008-03-17 11:20:28-07]

Assuming you are talking about the IPTC Caption-Abstract, this
will do it for you:

Code:
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        MyCaption => {
            Require => 'Caption-Abstract',
            ValueConv => '$val=~s/^\S+2008\s*//; $val',
        },
    },
);
1;  #end

This removes non-space characters up to "2008", and any following
spaces at the start of the caption.

Then use this command to edit the file to remove the date:

Code:
exiftool "-caption-abstract<myCaption" a.jpg

- Phil