Skip to content

Instantly share code, notes, and snippets.

@vmiheer
Created March 25, 2019 21:55
Show Gist options
  • Save vmiheer/5d87bb75b6e4c177d53d924ebb46e39c to your computer and use it in GitHub Desktop.
Save vmiheer/5d87bb75b6e4c177d53d924ebb46e39c to your computer and use it in GitHub Desktop.
Convert pin output to csv
"""
Pin output to csv
"""
import sys
import re
import argparse
startOfDynamicSection = False
outFile = open(sys.argv[2], 'w')
for line in open(sys.argv[1]):
if line == "# $dynamic-counts\n":
startOfDynamicSection = True
if not startOfDynamicSection:
continue
if line[0] == '#':
continue
outFile.write(re.sub(r"^[ ]*(\d+)[ ]+([^ ]+)[ ]+(\d+).*$", r"\1,\2,\3", line))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment