[ article index ] [ ] [ @mattmight ] [ +mattmight ] [ rss ] No one would mistake the average shell script for principled software. Yet, if we look at how scripts are used, patterns emerge. Unix is a bestiary of ad hoc databases: comma-, colon-, tab- and space-separated tables. Think of /etc/* or /var/log/* , or of columnar commands. Shell scripts commonly, if unknowingly, compose five (of six) primitive relational-algebraic operations on these tables: union, difference, projection, selection and renaming: cat acts like union; sed and grep act like selection; cut acts like projection; awk can perform renaming; and diff acts (almost) like difference. Relational algebra (whose sixth primitive operation is Cartesian product) is equivalent to both relational calculus and SQL. Cartesian product (and equijoin) are not difficult to create in bash. If you find yourself stumb...