powershell solves this by using structured data everywhere at the expensive of not working that well with plain text.
You should be able to run something like
ls -l | sort +date,-size
but you can't :-)There are plenty of ways to do things better with basic text interfaces - a more standardized header format for example.
If most tools just output tabbed separated values with a header, or the same thing vertically.. ie..
foo bar baz
1 2 3
4 5 6
or foo 1 4
bar 2 5
baz 3 6
It would have been a lot easier to write more "universal" tools that worked with this data.Or at least more tools like 'ifdata' that is part of moreutils.
$ ifdata -pa wlan0
192.168.1.2
Instead of the mess people come up with to parse ifconfig output.Bryan Cantrill even said in a presentation something like that it should be "Write programs to handle json text streams, because that is a universal interface" these days.
> ls -tl | sort -k 5 -n
ls -l | sort +date,-size
was to show how sorting by date ascending and size descending could work. 'sort' can sort by different fields in different orders, but to sort times properly you'd need to use ls with `--full-time` or --time-style=long-iso` which is in GNU ls but not the BSD ls on OS X.You'd end up with something like
ls -l --full-time |sort -k 6,5rn
But that doesn't quite work. Besides, the 'sort -k 6,5rn' instead of 'sort +date,-size' is exactly the kind of thing I was trying to show.We could have had a sort that let you do '+date,-size', instead we have a 'universal interface'.