Implementing SQL With Unix Utilities
SELECT col1, col2(i.e. projections) can be implemented with several variants of Unix utilities:cutandawkare the two most obvious.2. JOINcan be implemented with the… wait for itjoinutility. You’ll need to sort its input first, though.- Many
GROUP BYoperations can be performed with combinations ofgrep -c,sortwith or without the -urnk options (look at the man page — you can apply options to individual sort keys), anduniqwith or without the -c option. Many more can be done with 20 or 30 characters of awk.- Output formatting is easy with
column, especially with the -t option.
Reminded me of the now vanished from the Internet Ted Dziuba’s Taco Bell Programming.
Original title and link: Implementing SQL With Unix Utilities (©myNoSQL)
via: http://www.xaprb.com/blog/2012/10/12/implementing-sql-with-unix-utilities/