Find elements in the first array that are not present in the second array.
Code
Generalecho "$arr1" | jq --argjson b "$arr2" '[.[] | select(. as $x | $b | index($x) | not)]'Parameters
First JSON array
Second JSON array
Server
More Bash Snippets
Array Frequencies
Count how many times each value appears in an array and return a frequency map.
Array Head
Get the first n elements of an array.
Array Intersection
Find common elements that exist in both arrays.
Array Tail
Get the last n elements of an array.
Array Union
Combine two arrays and remove duplicates to produce a union.
Average Array
Calculate the arithmetic mean of all numbers in an array.