print "Generating histogram of focal lengths starting at $start, ending at $end, and with stepsize $delta in the directory $onlyin\n";
$commandstring="mdfind -onlyin $onlyin \"(kMDItemFocalLength>=$flength) && (kMDItemFocalLength < $endbin) && (kMDItemDisplayName = '*.$filetype*'cd) \" | wc -l";
#mdfind "kMDItemFocalLength>=10 && kMDItemFocalLength < 15) " | wc -l
Copy and paste this in a textfile (I named it flengthscript.pl) and save it in your home directory. Now open a terminal and type
perl flengthhistoscript.pl 0 300 5 "Your directory location here" NEF
Replace the location with the location where you store your images and replace NEF by whatever filetype you use or leave it blank to analyse all filetypes.
The script spits out a simple tab delimited list of focal lengths followed by the number of images it found in the range of the focal-length number+the delta that you chose. You can simply graph this in any graphing program such as Igor Pro, gnuplot, Numbers, IDL, Excel, etc.
Here is the output on about 20k RAW files that are currently on my harddisk. You can see I favor 18, 35, and 50 mm and also the top of my tele range which is 200 mm. This indicates I might like some longer lenses as well as wider lenses to add to my repertoire.