24 lines
416 B
Bash
Executable File
24 lines
416 B
Bash
Executable File
#!/bin/sh
|
|
|
|
if [ "$#" -ne 3 ]; then
|
|
echo "Usage: $0 input1.json input2.json output.json" >&2
|
|
exit 1
|
|
fi
|
|
|
|
i1="$1"
|
|
i2="$2"
|
|
out="$3"
|
|
|
|
echo "input 1 len: $(jq 'length' "$i1")"
|
|
echo "input 2 len: $(jq 'length' "$i2")"
|
|
|
|
jq -s '.[0] + .[1]' "$i1" "$i2" >"$out"
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo "merged files into $out"
|
|
echo "output len: $(jq 'length' "$out")"
|
|
else
|
|
echo "error merging files" >&2
|
|
exit 1
|
|
fi
|