saurav
saurav

Reputation: 3462

select is not recognized as an internal or external command - jq

I had downloaded jq and trying to get a hang of it on Windows. I am able to run some basic queries in jq but when I am trying to use select with jq I am getting the below mentioned message.

Below is the command which I am executing.

curl --basic -u admin:admin http://XX.XX.XX.XX:8080/mmc-console-3.7.3/api/deployments | jq .data[] | select(.name=="TestAccount").id

curl --basic -u admin:admin http://XX.XX.XX.XX:8080/mmc-console-3.7.3/api/deployments | jq .data[] | select(.name==\"TestAccount\").id

Output

select is not recognized as an internal or external command

I have jq in my path but not sure what I have to add in my path so that it can recognize `select as a command.

Upvotes: 0

Views: 4309

Answers (1)

Hans Z.
Hans Z.

Reputation: 54028

You need to quote the JQ expression, e.g.:

curl --basic -u admin:admin http://XX.XX.XX.XX:8080/mmc-console-3.7.3/api/deployments | jq '.data[] | select(.name=="TestAccount").id'

when on Windows you'll need to use double quotes and escaped double quotes as in:

curl --basic -u admin:admin http://XX.XX.XX.XX:8080/mmc-console-3.7.3/api/deployments | jq ".data[] | select(.name==\"TestAccount\").id"

Upvotes: 3

Related Questions