Created
          September 28, 2012 21:25 
        
      - 
      
 - 
        
Save op/3802158 to your computer and use it in GitHub Desktop.  
    Bash history to Zsh history
  
        
  
    
      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 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() | 
Just an update that this one didn't work for me on Ubuntu 18.10, Python 2.7.15
The link posted by @krasnobaev worked for me!
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Didn't work for me, but this one did: https://gist.github.com/muendelezaji/c14722ab66b505a49861b8a74e52b274
(Ubuntu 16.04.4)