You will need perl modules JSON and DateTime; Use the power of Google to install them
Output looks a little like this:
[minecraft@lolserver] /home/minecraft > lastLogin | sort -nr
2017-05-25 since seen XXX (68753bc2-3884-4615-9350-67898a5497)
2017-05-25 since seen YYY (0a24e315-b895-40d0-b799-f6621cd633)
THIS SCRIPT USES LAST WRITE TIME SO IF YOU FREQUENTLY OVERWRITE YOUR PLAYER DATA FILES, THIS WILL ALWAYS GIVE ERRONIOUS DATA OUT
You'll need to set $filename and $pdata to their proper locations
Licensing here: https://github.com/utoc/Dont-be-a-Jerk This is open source. Give credit where it is due if you decide to modify this script as I have done
If you're unsure of yourself, see the following: https://www.youtube.com/watch?v=eh7lp9umG2I