Skip to content

Instantly share code, notes, and snippets.

@epichub
Last active December 20, 2017 00:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save epichub/1cda5e4d2ac50788052f8c2f1448b414 to your computer and use it in GitHub Desktop.
Save epichub/1cda5e4d2ac50788052f8c2f1448b414 to your computer and use it in GitHub Desktop.
Convert CSH history to ZSH history from https://gist.github.com/op/3802158
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is how I used it:
# $ cat ~/.history | bash-history-to-zsh-history >> ~/.zsh_history
import sys
import re
def pairwise(iterable):
a = iter(iterable)
return zip(a, a)
def main():
data = []
for line in sys.stdin.readlines():
data.append(line)
for (p1,p2) in pairwise(data):
timestamp = re.match(".\+(.+)",p1).group(1)
sys.stdout.write(': %s:0;%s' % (timestamp, p2))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment