6 ms·
Yes, the structure is always there. The trick with unix pipes is that interpreting the structure is always on the receiving side. I don't care if this is CSV or
by mike_ivanov 6y ago
Yes, the structure is always there. The trick with unix pipes is that interpreting the structure is always on the receiving side. I don't care if this is CSV or TSV if all I want is the number of lines. I don't care about concrete representations such as JSON or YAML if all I want is to change one string (like a hardcoded server name) to another (like a variable reference). Can you see that? How about this: why would one need a spec or schema in order to pipe an XML file through gzip?
- fiddlerwoaroof 6y agoYeah, I think people underestimate the value of an “escape hatch” when dealing with structured data: a Java-style API can be great at controlling downstream developers and easing library maintenance. But, as a “end-developer” such APIs can be absolutely miserable to discover when you’re trying to quickly pull out a bit of data.
- shadowgovt 6y agoBut pretending JSON or YAML is something you can safely "change one string" on is a recipe for disaster unless you have total control of the whole pipe chain, input to output.
- mike_ivanov 6y agoHow is it less safe than changing them in a (scriptable) text editor?
- shadowgovt 6y agoIt's not. Neither is a safe approach. A safe approach to mutating JSON is something like a small amount of JS to read in the JSON, mutate it as javascript objects, and JSON.stringify the result.