ExifTool Forum

ExifTool => Newbies => Topic started by: aceknox on January 25, 2016, 09:58:12 AM

Title: Delete number/characters in image description
Post by: aceknox on January 25, 2016, 09:58:12 AM
Hi,

I just managed to copy the filenames to the image description via exiftool. Now I have the problem, that the filenames contain numbers, which should not be displayed in the image description.

filename: image_1.jpg -> image description: image_1
filename: image_2.jpg -> image description: image_2
etc

Is there a possibilty to delete the "_1" etc in the image description via exiftool?

thanks
ace
Title: Re: Delete number/characters in image description
Post by: StarGeek on January 25, 2016, 05:15:51 PM
Try this command on a test file to see if it does what you want
exiftool "-imagedescription<${imagedescription;s/_\d+$//}" FileOrDir
Title: Re: Delete number/characters in image description
Post by: aceknox on January 26, 2016, 04:02:13 AM
thanks for your help - it worked!!! :)

one other question: how can I delete a number if there is no _ in front of it? eg: "image 1"

thanks
ace
Title: Re: Delete number/characters in image description
Post by: StarGeek on January 26, 2016, 12:42:19 PM
Assuming that you want to remove the space as well, just change the underscore to a space:
exiftool "-imagedescription<${imagedescription;s/ \d+$//}" FileOrDir