On Fri, Oct 24, 2014 at 1:58 PM, Joshua Hoblitt <jhobl...@cpan.org> wrote:
> On 10/24/2014 11:49 AM, Wil Cooley wrote: > > On the other hand, I'm more likely to try to run grep on the master, > which > > does not work well with minimized JSON (I'm clever enough that I can do > it, > > but I would curse under my breath at having to do so). (Yes, I could > > probably query PuppetDB for these cases, but...) > > If you haven't already tried it, jgrep (http://jgrep.org/) can be helpful. > > And if you want a mind warping, but incredibly powerful, tool try out jq ( http://stedolan.github.io/jq/). I used it to process a directory full of json files into a single file that contained an analysis. echo *.analysis | xargs cat | jq -s 'map(.[] | select(has("Puppet::Pops::Model::ResourceExpression")) | to_entries) | add | group_by(.key) | map({ "key": .[0] | .key, "value": map(.value) | add }) | from_entries as $expressions | { "expressions": $expressions, "expressions_per_resource": (($expressions | to_entries | map(.value) | add) / ($expressions | .["Puppet::Pops::Model::ResourceExpression"])), "most_common_expressions": $expressions | to_entries | sort_by(.value) | reverse | .[0:9] | map(.key) }' Had to echo and cat because there were too many files for the command line. -Josh > > -- > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-dev+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-dev/544ABD92.7000309%40cpan.org. > For more options, visit https://groups.google.com/d/optout. > -- Andrew Parker a...@puppetlabs.com Freenode: zaphod42 Twitter: @aparker42 Software Developer *Join us at **PuppetConf 2015, October 5-9 in Portland, OR - * http://2015.puppetconf.com *Register early to save 40%!* -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/CANhgQXuQKwHiQHvyyrh%2BqWEhcJykgFcx9doqLsgLA5S4Anz1eA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.