Or don’t, I’m not your father.
The situation Sometimes, you want to get a very specific part of a command output. The classic problem is to get the IP address of an interface. Even today, the results to these queries on your favorite search engine will most likely involve grep, sed, awk and the like.
But what if I told you there’s a better way?
Using JSON for structuring data Some tools offer outputting their data in JSON format. That data can be processed with the venerable jq utility. The control you have over the processing is higher and the chance that the data format of the output changes is lower. Let’s look at what that means in practice.
One might wonder if at those file sizes, working with text still makes sense. I think there’s a good reason
journald
uses a binary format for storing all that data. And “real” databases tend to scale better than text files in a filesystem as well, even though a filesystem is a database.Most people won’t have to deal with that amount of text based data ever.