sort -g -k field_numNext generation Unix pipe by Alex Larsson
11–20 of 86 posts
Re: Next generation Unix pipe by Alex Larsson
#12In your example, if we just wanted to filter for a particular user, dps would have to print out ALL of the information and then you could pick at it. This doesn't seem bad for ps (because there's a hard limit) but in many other examples the output could be much larger than what is needed. That's why having filtering and output flags in many cases is more efficient in generating everything.
As a side note: To demonstrate a dramatic example, I tried timing two things:
- dumping NASDAQ feed data for an entire day, pretty-printing, and then using fgrep
- having the dumper do the search explicitly (new flags added to program)
Both outputs were sent to /dev/null. The first ran in 35 minutes, the second in less than 1 minuteRe: Next generation Unix pipe by Alex Larsson
#13I'd be all in with flags that make ps or ls spit JSON or XML, but this typed nonsense? What when I want to output a color? Will I need a new type?
Oh... and the sort thing... its not hard to sort numerically.
Re: Next generation Unix pipe by Alex Larsson
#14"Even something as basic as numerical sorting on a column gets quite complicated." sort -g -k field_num
Re: Next generation Unix pipe by Alex Larsson
#15If I can do a slight PG impression, "what problem does this solve?"
http://www.dwheeler.com/essays/fixing-unix-linux-filenames.h...
find -print0 is a lame hack, and even filenames with spaces (not newlines) are somewhat messy to work with on the Unix shell.
Or a little recurring problem I have: How do I grep the output of grep -C (matches showing multiple lines delimited with a "--" line)? I wrote a custom tool to do it, which does the job, but really it would be nice if I could use all the normal line-based Linux tools (sort, uniq, awk, wc, sed) with a match as a "line".
Re: Next generation Unix pipe by Alex Larsson
#16Re: Next generation Unix pipe by Alex Larsson
#17"Even something as basic as numerical sorting on a column gets quite complicated." sort -g -k field_num
Two problems: the header is sorted along with the fields, and you have to look up the field number. Insurmountable? No; but somewhat complicated.
Re: Next generation Unix pipe by Alex Larsson
#18Re: Next generation Unix pipe by Alex Larsson
#19Regarding this version, standardizing on a particular transfer format is a bad idea. If history has shown anything, it's that we like to reinvent this stuff and make it more complicated than necessary (see also XDR, ASN.1, XML, etc. :) pretty much on a 5 year cycle or thereabouts.
Do the bare minimum design necessary and let social convention evolve the rest.
Re: Next generation Unix pipe by Alex Larsson
#20What about providing a filter that converts to whatever format you can think of? e.g. outputs in JSON or XML