Hi there,
I have just started using ExifTool and I am really happy to have found this amazing tool. Unfortuantelly, I am dealing with an issue for which I appriciate your help.
I got a large number of images and other files in a folderstructur which may contain line breaks in the following EXIF tags:
- Caption-Abstract
Description
Image Description
Keywords
Subject
I do not need to change any EXIF data, I only need to extract the tags from the files as a CSV using the option: exiftool -config ExifTool_config -a -csv -G1 -s -r --Keywords s:\ >"output.txt"
I found this solution:
https://exiftool.org/forum/index.php/topic,1962.msg8559.html#msg8559 (https://exiftool.org/forum/index.php/topic,1962.msg8559.html#msg8559)
But it does not work for me, unless there is a line break in the tag, otherwise it is not displayed in the output.
I was hoping to ignore all tags with line breaks and instead using all the new tags which I generated using the config file
Example:
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
'NEW Description' => {
Require => 'Description',
ValueConv => '$val =~ s/[\n\r]+/ /g ? $val : undef',
},
'NEW Subject' => {
Require => 'Subject',
ValueConv => '$val =~ s/[\n\r]+/ /g ? $val : undef',
},
'NEW Keywords' => {
Require => 'Keywords',
ValueConv => '$val =~ s/[\n\r]+/ /g ? $val : undef',
},
'NEW Caption-Abstract' => {
Require => 'Caption-Abstract',
ValueConv => '$val =~ s/[\n\r]+/ /g ? $val : undef',
},
'NEW ImageDescription' => {
Require => 'ImageDescription',
ValueConv => '$val =~ s/[\n\r]+/ /g ? $val : undef',
},
},
);
My question is, how can I modify this config file, so that regardless a line break or not in a tag, the NEW tag is generated in the output?
Thanks for your help in advance!
Joao
[/list]
Good for you for searching through the archives. But that post is outdated and exiftool can now do global arbitrary string processing with the -api Filter option.
To replace 1 or more CR/LF with a single space (as you show in your user defined tags), you can do this
exiftool -a -csv -G1 -s -r --Keywords -api "Filter=s/[\n\r]+/ /g" s:\ >"output.txt"
This is great, it solves my issue.
Thanks StarGeek ! :-)