4 ms·
text streams are only a universal interface when working with text. It's one thing to use tr, sort, and uniq to count the number of words in a file. It's anot
by justinsaccount 8y ago
text streams are only a universal interface when working with text. It's one thing to use tr, sort, and uniq to count the number of words in a file. It's another thing entirely to take commands like ifconfig that output human readable data and then try to do things like
ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | tail -1 | cut -d: -f2 | awk '{ print $1}')
(grabbed from first SO question I could find)
Text streams were great 40 years ago, but you run into the limitations of what you can do properly with awk and sed pretty quickly.
Passing structured data through pipes using a standard format would have been a universal interface. Text streams are really just a void* pointer. Sure, you have the data, but good luck making sense of it.
- amaccuish 8y agoI feel like powershell has the right idea here. Samba have just started adding json output to their audit logs for example. If we had a really good set of json tools, then I'd hope they'd be a tendency for programs to implement a --json option for easier processing.
- deleted 8y ago[deleted]
- dsr_ 8y agoThe really odd thing is that there's a great method of doing this that many -- but by no means all -- tools support: dedicated data separator characters. 01 SOH(Start of Header) 02 STX(Start of Text) 03 ETX(End of Text) 04 EOT(End of Trans.) 05 ENQ(Enquiry) 06 ACK(Acknowledgement) 21 NAK(Negative acknowl.) 22 SYN(Synchronous idle) 23 ETB(End of trans. block) 28 FS(File separator) 29 GS(Group separator) 30 RS(Record separator) 31 US(Unit separator) You've got everything you need there to build really useful serialized data pipelines, and it would only be a day's work to implement them as a library in pretty much any language.
- AnIdiotOnTheNet 8y agoIn-band signaling is not a good idea. Case in point: spaces and quote characters in path names.
- kbenson 8y agoOr... if designing a program meant to work in a shell environment that is all text that comes with text parsing tools, provide a normalized, easily parsed output option. Processing structured data is great, but like a lot of complaints here, it's basically "why didn't they just choose this much more complex and time consuming option that was as yet unproven?"