5 ms·
From the article: The new programs, called Context-Free Grep and Hierarchical Diff, will provide the ability to parse blocks of data rather than single lines.
by winestock 15y ago
From the article:
The new programs, called Context-Free Grep and Hierarchical Diff, will provide the ability to parse blocks of data rather than single lines. For each new type of data structure, a vendor would provide a pattern library identifying the basic structure of the data, which the software would then use to "extract the constructs of interest from the document," Weaver said.
So how does the above fit into the Unix Philosophy's dictum that "Everything is just a stream of bytes (of text)?" Or does it?
- zokier 15y agoNew tools, new philosophies. I would imagine that the new grep would fit well in the json-riddled world that is web these days.
- mhansen 15y agoCheck out jsonpipe, it makes json greppable. https://github.com/dvxhouse/jsonpipe https://github.com/dvxhouse/jsonpipe
- deleted 15y ago[deleted]
- onli 15y agoDepends on how they output the extracted "construct of interest". In the end, this may very well be a stream of bytes. But that exactly was my thinking as well. Complicated data-types sure need different tools, but if you want to use somethinng like grep and diff, it would be nice to have simple data. Which leads to the thinking that not grep and diff are the issue, but the data. Though the article even states it's not about replacement, but about a different area of usage: >Such utilities could provide administrators the ability to work with more complex forms of data now being generated by network equipment and infrastructure software.
- lukeschlather 15y agoGrep and diff just aren't suited to dealing with nested data structures where whitespace and/or newlines are irrelevant. There's some data that's intrinsically nested, and we can't really simplify the world to make parsing easier. A good CFG engine like the article proposes would be very useful.
- scottw 15y agoMore than one Unix Philosophy tenet broken here. It does, however, seem wholly consistent with modern Linux Philosophy.
- jff 15y agoIt does fit into that dictum, or at least grep does. Your file is still a stream of bytes. Rather than providing a regular expression, though, you create a context-free grammar to specify the structure of different things, presumably even multi-line structures. Grep then parses the file, making it less "grep" and more "the first stage of a compiler". Seems like a neat idea, but I probably wouldn't find myself using it too much--and if you think vendors are going to provide context-free grammars (that actually work!), well, you're a more optimistic man than I.
- jws 15y ago"Everything is just a stream of bytes (of text)?" Neither grep nor diff operate on a stream of bytes in their most common form. They operate on data structures called "lines" extracted from the stream of bytes according to a pattern hardcoded into the tools themselves. Now that the camel's nose is under the tent…