txtselect - version 1.0 - Python 2.6 or above (including 3.x)
Project administrator:
Applies a simple SQL query (without joins) to a tab-separated-value text file. As an example, suppose we want to determine the total population for each U.S. state, and we have a file where each line has a county name, the state name, and county population, separated by tabs.
txtselect 'c2, sum(c3) from county-pops.txt group by c2'
Supported syntax:
[SELECT] expr [, expr ...]
[FROM filename]
[WHERE expr]
[GROUP BY expr [ASC | DESC] [, expr [ASC | DESC] ... ]
[HAVING expr]
[ORDER BY expr [ASC | DESC] [, expr [ASC | DESC] ...]
[LIMIT { count | offset, count | count OFFSET offset }]
Supported operators: ** * / % + - = == != <> < > <= >= not and or
Supported aggregate functions: count, sum, avg, min, max, first, last
Supported scalar functions: abs, bin, ceiling, concat, concat_ws, floor, hex, if, instr, left, length, lower, lpad, ltrim, oct, ord, right, round, rpad, rtrim, space, substr, trim, upper
Copyright (c) 2011, Carl Burch. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
version 1.0, 11 Sep 2011 - Carl Burch - initial release