ExifTool Forum

ExifTool => Newbies => Topic started by: tps800 on December 26, 2018, 05:33:23 AM

Title: Any way to print exif-values with surrounding '"'?
Post by: tps800 on December 26, 2018, 05:33:23 AM
If I execute exiftool -exif:Make -exif:Model -exif:FocalLength -exif:ExposureTime -exif:ISO -exif:LightSource -exif:LensModel -common_args -s3  k-20181224-170120-000_tps.jpg I#ll get:

SONY
ILCE-9
30.0 mm
1/640
250
Daylight
15-30mm F2.8 SSM


Any way to have it print

"SONY"
"ILCE-9"
"30.0 mm"
"1/640"
"250"
"Daylight"
"15-30mm F2.8 SSM"


I could not find any option or something like that to add '"'.
Title: Re: Any way to print exif-values with surrounding '"'?
Post by: StarGeek on December 26, 2018, 12:58:26 PM
You can use the -api Filter option.  On Windows CMD, you would add -api "filter=s/^|$/\"/g" or -api "filter=s/^|$/"""/g" as the double quote needs to be escaped.  On linux/Mac, I think it would be -api 'filter=s/^|$/"/g'.
Title: Re: Any way to print exif-values with surrounding '"'?
Post by: tps800 on December 26, 2018, 04:14:37 PM
Yes, that works, but it does not help to push output to single bash variables to print them as needed.

What I'd like to have is
exiftool \
  -exif:Make \
  -exif:Model \
  -exif:FocalLength \
  -exif:ExposureTime \
  -exif:ISO \
  -exif:LightSource \
  -exif:LensModel \
  -common_args -s3  k-20181224-170120-000_tps.jpg


this gives:
SONY
ILCE-9
30.0 mm
1/640
250
Daylight
15-30mm F2.8 SSM


Now any idea how to have that formated:
SONY ILCE-9 • 30.0mm • 1/640s • 250iso • Daylight
Lens: 15-30mm F2.8 SSM


Any hint where I could start would be nice!
Title: Re: Any way to print exif-values with surrounding '"'?
Post by: StarGeek on December 26, 2018, 05:07:34 PM
Take a look at the -p option (https://exiftool.org/exiftool_pod.html#p-FMTFILE-or-STR--printFormat).

exiftool -p "$exif:Make $exif:Model • $exif:FocalLength • $exif:ExposureTime • $exif:ISO • $exif:LightSource$/Lens: $exif:LensModel" k-20181224-170120-000_tps.jpg

The -Common_Args option (https://exiftool.org/exiftool_pod.html#common_args) in your command isn't needed.  It doesn't do anything except in conjunction with the -execute option (https://exiftool.org/exiftool_pod.html#execute-NUM).

See FAQ #21 (https://exiftool.org/faq.html#Q21) for details on the $/ in the above command