f.lapo.it

Just in case you need a NodeJS script to sort extended #ZSH history which doesn't break on multi-line entries:

#! /usr/bin/env node
const fs = require('fs');
const lines = fs.readFileSync(process.argv[2], 'utf8').split(/(?<=[^\\])\n/);
lines.sort((a, b) => a.split(/:/)[1] - b.split(/:/)[1]);
fs.writeFileSync(process.argv[2], lines.join('\n'), 'utf8');
#ZSH