Replacing newline or lf when using -printFormat

Started by elvee, February 25, 2011, 03:28:12 PM

Previous topic - Next topic

elvee

When using the -T swith all newline en lf characters in the Caption-Abstract tag are replaced by "."; If I don't want that I can use the -b switch.
But with the -p switch I don't have a choice: newline en lf characters won't be replaced. Is this by design or am I missing something?

Phil Harvey

This is correct.  Newlines are not replace in the -p output.

You can do this with a user-defined Composite tag if you really need to.

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

elvee

Thank you for your answer. I now use this composite tag code I found on this forum to translate newlines into semicolons:


%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        NewCaption => {
            Require => 'Caption-Abstract',
            ValueConv => '$val =~ s/[\n\r]+/;/g ? $val : undef',
        },
    },
);


In the printformat file I use $newcaption to print this composite tag. Works like a charm.