3 ms·
I could not agree more. And even with the things you mentioned, such a script will still be tiny and very readable. You just have to love the simplicity.
by sauere 12y ago
I could not agree more. And even with the things you mentioned, such a script will still be tiny and very readable.
You just have to love the simplicity.
- nextos 12y agoI love Unix, but it's just a local minima in the design space. For example, it's typical text processing pipelines are hard to branch. I have hacked up some solutions, but never found them very elegant. I would love to hear some solutions to this. Ended up switching to Clojure (Prismatic's) Graph.
- LeoPanthera 12y ago> For example, it's typical text processing pipelines are hard to branch. I'm not entirely sure what you mean by this, but it sounds like you should use "tee" pointing at a fifo.
- ajuc 12y agoThe problem - you have file, you want to do one thing for lines matching REGEX and other thing for lines not-matching REGEX. How to do it without iterating the file 2 times? You can do while of course, but it defeats the reason to use shell. I would love to have two-way grep that writes matching lines to stdout and nonmatching to stderr. I wonder if grep maintainers would accept new option for grep "--two-way".
- jiffytick 12y agoawk can write to stderr.
- ticviking 12y agoWhich is for errors.
- barrkel 12y agoWrite to more than one fifo from awk. If you're composing a dag rather than a pipeline, fifos are one way to go. Personally though, I'd output to temporary files. The extra cost in disk usage and lack of pipelining is made up for by the easier debugging, and most shell pipelines aren't so slow that they need that level of optimization.