[Originally posted by linuxuser on 2008-07-16 20:08:43-07]
Is it possible to create a line break in the field 0x010e Image Description?
[Originally posted by exiftool on 2008-07-16 21:18:12-07]
Yes.
[Originally posted by exiftool on 2008-07-16 21:26:37-07]Haha. I wouldn't do that to you.

There are three ways:
1) In a Unix shell, you can put a line break in the command
using "\" at the end of the line (not sure if you can do this in
Windows though):
exiftool -imagedescription="line 1\
line 2" image.jpg
2) Create a file with the the exact description, including
linebreaks, and write the value from the contents of the
file:
exiftool -imagedescription"<=file.txt" image.jpg
3) Use $/ in a redirection expression to generate the newline:
exiftool "-imagedescription<line 1${/}line 2" image.jpg
The third technique, however, incurs a performance penalty since
it will first read the file to extract tag values in case they are used
in the expression (which they aren't).
- Phil
[Originally posted by linuxuser on 2008-07-16 22:07:27-07]I use linux. The description is imported from a textfile with a bash script. Every line in the textfile contains the description of 1 photo. So I need a description in 1 line like
"photo1,line1\line2"
If I create a variable
descr="photo1,line1\line2"
and use it with exiftool the description field shows the backslash with exiftool and not a linebreak.
I would consider your 2nd option, if I can't get it work with your 1st suggestion. Thanks!
[Originally posted by exiftool on 2008-07-16 23:59:16-07]Oh yeah. "linuxuser" is linux. Silly me.

I just tried a bunch of shells (sh, csh, bash, zsh), and of these the
backslash at the end of a line only adds a newline in csh. But the good
news is that I played around a bit in bash and it is even easier --
you can insert an actual newline in a quoted string:
#!/bin/bash
descr="line1
line2"
exiftool -imagedescription="$descr" image.jpg
The above bash script works for me, but of course you need
to use the
-b option to see the newline when you
extract the value.
- Phil
[Originally posted by linuxuser on 2008-07-17 19:38:09-07]Phil,
I tried the following and I changed the field to caption-abstract
var="line1
line2"
var2=`echo $var | tr '
' '\n'`
exiftool -caption-abstract="$var2" image.jpg
It creates linebreaks, but there are 3 linebreaks between line1 and line2 insteade of 1
Maybe you should know, that I would like to have this linebreak, because I like to make multilingual descriptions.
Thank you!
[Originally posted by linuxuser on 2008-07-17 19:49:38-07]It was not a good idea to use tr, with sed it works:
var2=`echo $var | sed 's/
/\n\n'/g`