in reply to sort timestamps with associated names.
Some hints how I would solve this:
- Your date format yyyy-mm-dd hh:mm:ss is already suitable for lexographical sorting, no need to change the format.
- The date is the last 19 characters of each line, so it can be extracted easily using either a regex or substr.
- If you read line by line, don't forget to chomp;
- The Schwartzian Transform is one way to approach this. Read here: Understanding the Schwartzian transform.