When it comes to building a database, Linux offers a simpler and more transparent alternative to relational databases driven by SQL. One of the simplest structured text formats is DSV (delimiter-separated values), which can be used to store data such as todo lists.
In this article, we’ll explore how to create and use a database using standard Linux tools. We’ll cover topics such as creating tables as flat files, fetching an entire table, selecting columns, and sorting rows.
To get started, you can use the `cut` tool to extract specific fields from your data. For example, to select all tasks in your database, you can use the command `cut -d’:’ -f1 tasks`. To narrow down your selection, you can use the `grep` command with a regex pattern.
However, when dealing with more complex queries, Linux lacks the power of SQL’s `grep`, `awk`, and `sort` commands. In such cases, you need to rely on more powerful tools like `awk`.
Once you’ve joined two tables together using the `join` command, you can use `cut` or `awk` to clean up the output.
To demonstrate the power of these Linux tools, we’ll create a pipeline that joins both tables to get names, selects specific columns, and fetches rows with a certain priority. The equivalent SQL expression is no more complicated than this pipeline.
With these core tools at your disposal, you can build complex databases using standard Linux commands. Whether you’re a seasoned developer or just starting out, building a database with Linux tools will take you far.
Source: https://www.howtogeek.com/build-a-database-with-powerful-linux-built-in-tools