I have a large folder tree, and would like to make a script to open up gThumb or some other image viewer based on a keyword search. exiftool
is already installed on my system. and the command
exiftool -a -r -G1 -s $FILE
prints the data out in format
[ExifTool] ExifToolVersion : 8.60
[System] FileName : 4-4_wlax_0127.jpg
[System] Directory : .
[System] FileSize : 6.3 MB
[System] FileModifyDate : 2012:04:05 13:57:54-04:00
[System] FilePermissions : rwxrwxrwx
Currently,
exiftool -a -r -G1 -s . | grep Keywords | grep "$1*"
prints out the Keyword row of the metadata as
[IPTC] Keywords : 2012, Womens Lax, ..., ...
where $1
is the keyword search value. Right now, my solution is to use two loops, each executing an exiftool
call for a different grep value. How can I excute a single exiftool
call that for matching keywords, the associated filename is passed to a list.
EDIT- Clarification:
If a match exits to the Keyword field, I want to print out the FileName row. However, Keyword exists ~20 lines below FileName in the text output.