Created
October 23, 2015 07:20
-
-
Save michal-mally/b9b9a870a50a0e3ac3e6 to your computer and use it in GitHub Desktop.
This file contains 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
def lines = new File('/Users/mmally/temp/bash_history_merged').readLines() | |
def entries = new TreeMap<Long, String>() | |
def text = lines | |
.collate(2) | |
.collectEntries(entries) { time, cmd -> | |
[(time - '#').toLong(), cmd] | |
}.collectMany { k, v -> | |
["#$k", v] | |
}.join('\n') | |
new File('/Users/mmally/temp/bash_history_merged_sorted').text = text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment