Extending UNIX grep to databases

The grep command among with its myriad of options allows searching text files for the occurrence of strings or patterns. This can be extended both to RDBMS and non-SQL databases like Mongodb.

The problem however is more complex than simply query lines of text files. A practically useful CLI must address:

  • Database connections containing network addresses, database id values, username/password combinations.

  • Search restrictions to:

    • Tables

    • columns

    • Records i.e. defined by WHERE clauses.

A tool might be implemented either as a single command or as a terminal based application keeping state information.