ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Al_Bundy on November 26, 2020, 12:06:30 PM

Title: Delete keywords that contain specific string
Post by: Al_Bundy on November 26, 2020, 12:06:30 PM
Hello Exif Community,

my images contain a lot of keywords in xmp-files (xmp:subject).

I would like to delete all keywords that contain a specific string using the exiftool.

Example:
Contained keywords: abc_1, abc_2, abc_3, cde_1, cde_2, cde_3

Keywords to be deleted: abc_1, abc_2, abc_3
Keywords to be obtained: cde_1, cde_2, cde_3

So far I am at the following command:

exiftool 'dir/file.xmp' -overwrite_original -m -'xmp:subject-=~ /abc/' -if '$xmp:subject =~ /abc/'

Unfortunately it does not work.

Do you have an idea?

Thanks for your support.

Al
Title: Re: Delete keywords that contain specific string
Post by: StarGeek on November 26, 2020, 12:31:49 PM
Try
exiftool 'dir/file.xmp' -overwrite_original -m -sep ',' -if '$xmp:subject =~ /abc/' '-Subject<${Subject@;$_=undef if m/abc/}'