#1101·jq

Filter to shell command

Author: ktfCreated Feb 17, 2016Updated Jun 28, 2026
Labelsfeature requestfeature request: jq function librarydup

First of all thank you for jq. It rocks.

I was thinking it would be extremely useful to be able to pipe the output of a filter to a shell command, as stdin. What I want to do is to get a JSON array and execute the same command on each element of the array, taking each item a stdin and with the ability to specify jq queries as part of the command line. Something like:

.[] | exec cat > .filename