set difference - JQ: setdiff of two arrays -
if have object 2 arrays containing unique values in it
{"all":["a","b","c","abc"],"some":["b","c"]}
how can find .all - .some
?
in case looking ["a","abc"]
@jeff mercado blew mind! didn't know array subtraction allowed...
echo -n '{"all":["a","b","c","abc"],"some":["b","c"]}' | jq '.all-.some'
yields
[ "a", "abc" ]
Comments
Post a Comment