Created
January 9, 2014 04:28
-
-
Save tianhuil/8329413 to your computer and use it in GitHub Desktop.
col2tsv: converts a single column by breaking it up by the first column
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
#!/usr/bin/env python | |
import sys | |
n_rows = int(sys.argv[1]) | |
data = map(lambda x: [], xrange(n_rows)) | |
for k, line in enumerate(sys.stdin): | |
data[k % n_rows] += [line.rstrip()] | |
for d in data: | |
print "\t".join(d) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment