Last active
August 3, 2023 13:58
-
-
Save dmpop/0c224fda1c92c5bf62120702e164b17f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 2 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with this program; if not, write to the Free Software | |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
# MA 02110-1301, USA. | |
# Author: Dmitri Popov, [email protected] | |
# Source code: https://gist.github.com/dmpop/0c224fda1c92c5bf62120702e164b17f | |
if [ ! -x "$(command -v exiftool)" ]; then | |
echo "Make sure that ExifTool is installed" | |
exit 1 | |
fi | |
if [ -z "$1" ]; then | |
echo "USAGE:" | |
echo "$0 LensID" | |
echo "$0 Model" | |
exit 1 | |
fi | |
echo "Working..." | |
results=$(mktemp) | |
exiftool -r -q -q -m "-$1" . | cut -d":" -f2 >>"$results" | |
if [ -f "$1.csv" ]; then | |
rm "$1.csv" | |
fi | |
echo "$1, Count," >>"$1.csv" | |
sort "$results" | uniq -c | awk '{print $0 ", " $1 ","}' | awk '{$1=""; print $0}' | awk '{$1=$1;print}' >>"$1.csv" | |
echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment