3 ms·
Most commands that you would want to put into a pipeline already have some sort of machine parsable output flag (tabular, json, format specifier, etc). Still, t
by Skunkleton 6y ago
Most commands that you would want to put into a pipeline already have some sort of machine parsable output flag (tabular, json, format specifier, etc). Still, there is not much reason to call ls from a script at all. In python you would be better off with the native libraries. In bash, you would probably be best off with `find /usr/bin -maxdepth 1 -size +50M` in your usecase.
IMO people have been trying to do the same thing with these tools since they were invented. Better to learn how to use them the way they were intended before reinventing them.
Edit: re-read my comment. Seems a little negative. Sorry. To be clear, I think the jc/jq approach is much better than the roll-your-own parser in shell approach.
- kbrazil 6y agoOne use case that has come up is to parse the output of commands your run on remote hosts that may not even have python installed. I have a PR into Ansible community.general plugins to add this functionality and it works pretty sweet. There are some other automation tools that are looking into this approach as well.