Created
October 8, 2024 20:20
Sort extended ZSH history (works with multi-line entries)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment