find /$PHOTODIR/ -name "*.JPG" -exec "exiftool {}" \; | grep "Focal Length" | split -f2 -d":" | sed "s/.0//" | sort -g | uniq -c > FocalLength.txt
Reference: http://www.pentaxforums.com/forums/249573-post5.html
Reference: http://www.pentaxforums.com/forums/249573-post5.html
I have also used Exiftool to extract that information directly and use GNUPlot for plotting them, simple and nice!