Created
September 28, 2012 21:25
-
-
Save op/3802158 to your computer and use it in GitHub Desktop.
Revisions
-
op renamed this gist
Sep 28, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
op created this gist
Sep 28, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # # This is how I used it: # $ cat ~/.bash_history | bash-history-to-zsh-history >> ~/.zsh_history import sys def main(): timestamp = None for line in sys.stdin.readlines(): line = line.rstrip('\n') if line.startswith('#') and timestamp is None: t = line[1:] if t.isdigit(): timestamp = t continue elif timestamp: sys.stdout.write(': %s:0;%s\n' % (timestamp, line)) timestamp = None if __name__ == '__main__': main()