Hello all,
I have added to the Keywords field of every of my pics several tags through the Photoshop Elements program.
So for example, one file might have the Keywords Home, Baby, Food, Play.
I would like to extract all Keywords to datamine them, notably to count them.
Using exiftool -T Keywords a.jpg > out.txt gives me the following :
Home, Baby, Food, Play
Using exiftool -T Keywords -csv a.jpg out.csv gives me:
SourceFile,Keywords
a.jpg,"Home, Baby, Food, Play"
Can I format the output so that each of the tags in the Keywords field is listed on one line. For example, I would like to have the following output for a file:
Home
Baby
Food
Play
Is this possible?
Thanks in advance for your help!
Cheers,
exiftool -keywords w300_1349_wb.jpg -sep "\n" -b
Barbados
scuba
Fork Reef
Hawsbill
Worked for me. Run exiftool and search for -sep in the documentation as I am not sure of the implications of the -b flag.
Hi Alan,
Just great, awesome!
Worked for me too! :)
Thanks a lot!
Cheers,
Quote from: Alan Clifford on May 11, 2019, 05:23:23 PM
Worked for me. Run exiftool and search for -sep in the documentation as I am not sure of the implications of the -b flag.
Actually, the
-sep option (https://exiftool.org/exiftool_pod.html#sep-STR--separator) isn't doing anything in this case. It's the
-b (binary) option (https://exiftool.org/exiftool_pod.html#b--binary). If you remove the -b, you'll get
Barbados\nscuba\nFork Reef\nHawsbillAn additional problem with just -b will be that the results will bleed into each other. So if there's more than one file, you'll get something like
Barbados
scuba
Fork Reef
HawsbillBarracuda
Coral Reefwhere Barracuda is from the next file in line.
Try the
-n (printConv) option (https://exiftool.org/exiftool_pod.html#n---printConv)
exiftool -p "${keywords;s/, /\n/g}" File1.jpg File2.jpg
To avoid the bleeding problem, you could also do this:
exiftool -sep "\n" -sep "\n" -b FILE
(I had forgotten about this feature -- lucky we have such good documentation.)
- Phil
Quote from: StarGeek on May 12, 2019, 03:45:32 AM
exiftool -p "${keywords;s/, /\n/g}" File1.jpg File2.jpg
Hello,
After trying the previous tip on several files, I had encoutered the bleeding problem abd was coming back to ask for an answer, but I find it already answered. This did the stuff and I have only one time per line even with several files.
Thanks a lot!
Quote from: Phil Harvey on May 12, 2019, 07:58:32 AM
exiftool -sep "\n" -sep "\n" -b FILE
Yup also works!
Thanks a lot too!
Apart from the fact, it is a tad easier to write down than the other anti-bleed methode, any reason to prefer one or the other?
Cheers,
I can't see any reason that one technique is better than the other.
- Phil
Quote from: Phil Harvey on May 12, 2019, 08:34:53 AM
I can't see any reason that one technique is better than the other.
- Phil
Ok great thanks again for all the quick answers!
Cheers,