remove a line in a caption

Started by dijkstra, January 27, 2013, 07:52:46 AM

Previous topic - Next topic

dijkstra

Is it possible to remove a line in a caption ? I inhereted a digital photoarchive from a passed away collegue and I have to remove the copyrightline that he did place in the caption in about 40.000 pictures. The rest of the caption must stay intact.
Thanks for your help

Phil Harvey

This is easy using the very-soon-to-be-released ExifTool 9.15, like this:

exiftool "-caption-abstract<${caption-abstract;s/Copyright.*//}" FILE

(The quoting above is for windows, and I am assuming that you want to edit the Caption-Abstract tag and that the copyright  line starts with the word "Copyright".)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

ExifTool 9.15 is now available.

A problem with the command I gave above is that it will leave the newline character.  I think this may remove it too:

exiftool "-caption-abstract<${caption-abstract;s/Copyright.*\\n//}" FILE

but I can't test this.  The only question is how to escape the backslash on the Windows command line, but I think the double backslash should do it.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

Quote from: Phil Harvey on January 27, 2013, 01:56:22 PM
This is easy using the very-soon-to-be-released ExifTool 9.15, like this:

exiftool "-caption-abstract<${caption-abstract;s/Copyright.*//}" FILE

Thank you so very much for this!!  I'll certainly be giving it a workout.
* 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).

StarGeek

Quote from: Phil Harvey on January 27, 2013, 03:17:19 PM
but I can't test this.  The only question is how to escape the backslash on the Windows command line, but I think the double backslash should do it.

Single backslash seems to work fine.  I tested
ExifTool "-caption-abstract<${caption-abstract;s/\n/\r\n/g}" Test.jpg

And it replaced all LFs with CR+LF.
* 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).

dijkstra

GREAT ;-)
I will try that tomorrow

thanx
roel