Revision 4662
Added by Aaron Marcuse-Kubitza about 12 years ago
bin/cols | ||
---|---|---|
1 | 1 |
#!/usr/bin/env python |
2 | 2 |
# Selects columns from a spreadsheet |
3 |
# CSVs without a header are supported. |
|
3 | 4 |
|
4 | 5 |
import csv |
5 | 6 |
import os.path |
... | ... | |
20 | 21 |
reader = csv.reader(sys.stdin) |
21 | 22 |
writer = csv.writer(sys.stdout) |
22 | 23 |
def subset(row): return util.list_subset(row, col_nums) |
23 |
writer.writerow(subset(reader.next())) |
|
24 | 24 |
for row in reader: writer.writerow(subset(row)) |
25 | 25 |
|
26 | 26 |
main() |
Also available in: Unified diff
cols: Support CSVs without a header, such as intermediates that become unmapped_terms.csv, new_terms.csv