Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I 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.



> 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.


The 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".


Write 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.


awk can write to stderr.


Which is for errors.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: