4 ms·
Text generally needs to be formatted somehow, after all it does represent data. So how do you format the text? You can use newline-deliminated values, if your d
by traverseda 5y ago
Text generally needs to be formatted somehow, after all it does represent data. So how do you format the text? You can use newline-deliminated values, if your data is simple enough. This is great for things like iterating over a set of files, as each file is just a path separated by a newline.
What about more complicated data though? Maybe you format the text as json? You can still use text-parsing tools like grep with it, but you can also use more specific text processing tools like JQ.
"Just text" is actually pretty complicated, a CSV and a JSON file are both "just text". You've got to have some structure somewhere, even if only by convention.
- chadlavi 5y agoSure, but a program like jq will essentially throw a type error if you try to pipe it stuff that isn't in a format it can do something with. Generally speaking you're not going to get silent errors when you try to extract formatted data from plain text content. And at the point that you need types, maybe the shell isn't the place to be doing that data manipulation?