I was trying to parse an OCI JSON output using JQ and getting syntax error in Windows powershell however the same command is working fine in Bash terminal. Pleae let me know if i miss anything.
PS C:\myfiles> oci compute instance list-vnics --all --compartment-id xxxxxx --profile myprof |C:\myfiles\jq-win64.exe ".data[]|select(."hostname-label"=="test1" )"
jq: error: syntax error, unexpected $end, expecting ';' or ')' (Windows cmd shell quoting issues?) at <top-level>, line 1: .data[]|select(. jq: 1 compile error PS C:myfiles>
Tried with the JQ statement in single quotes, its giving below syntax error:
PS C:\myfiles> oci compute instance list-vnics --all --compartment-id xxxxx --profile myprof |C:\myfiles\jq-win64.exe '.data[]|select(."hostname-label"=="test1" )'
jq: error: syntax error, unexpected ==, expecting '$' (Windows cmd shell quoting issues?) at <top-level>, line 1: .data[]|select(.hostname-label==test1 ) jq: 1 compile error PS C:\MYDATA\myfiles>
I tried the same in jplay.org and it was working fine there as well. Please let me know how to fix this in Windows.
Thanks
\-escaping of embedded"characters is required in arguments passed to external programs. This may get fixed in 7.2, which may require opt-in. See this answer to the linked duplicate for details.