4 ms·
I'm not saying that Unix's approach is the the final word on the subject. In fact, I quite agree with you: structured formats are a good idea. I, for one, woul
by snprbob86 16y ago
I'm not saying that Unix's approach is the the final word on the subject. In fact, I quite agree with you: structured formats are a good idea.
I, for one, would like to see --format options added to many of the standard Unix tools. I'd probably define --format= as a shortcut for specifying both --informat= and --outformat=. It would be great to have some sort of XPath or dotted object notation on the command line rather than hacking around with awk, sed, cut, etc.
Rather than:
ps -ef | awk -v p=$PPID 'p==$3{print $2}'
Do:
ps --format=xml | xquery "/process[ppid=$PPID]/pid"
Or something like that. A bit more verbose, but far more understandable.
If I were to design the future, every tool would have metadata which describes which input and output formats it supports and prefers, so that most --format arguments would be optional:
ps | xquery "/process[ppid=$PPID]/pid"
I'd prefer that 100 times over object piping.