I have 2 arrays defined below.
Arr1
"name": "key1", "value": "value1"
"name": "key2", "value": "value2"
"name": "key3", "value": "value3"
Arr2
value1=/other/path/to/file1
value3=/other/path/to/file3
I want to map these 2 arrays in such a way that my resulting array must look like below.
Output Array
"name": "key1", "value": "/other/path/to/file1"
"name": "key2", "value": "value2"
"name": "key3", "value": "/other/path/to/file3"
So basically I need to write some command in my bash script which will do such mapping and provide me required output.
Output of declare -p Arr1 Arr2 is:
declare -p arr1 arr2
declare -a arr1='([0]="name:" [1]="key1," [2]="value:" [3]="value1" [4]="name:" [5]="key2," [6]="value:" [7]="value2" [8]="name:" [9]="key3," [10]="value:" [11]="value3")'
declare -a arr2='([0]="value1=/other/path/to/file1" [1]="value3=/other/path/to/file3")'
basharrays you've maintained