I have a file status.txt which is in the following format:
1|A|B
2|C|D
Now i have to read this file in shell script and create a dictionary like:
dictionary['1'] = ['A', 'B']
dictionary['2'] = ['C', 'D']
I am able read the content of file using this:
while read line
do
key=$line | cut --d="|" -f1
data1=$line | cut --d="|" -f2
data2=$line | cut --d="|" -f3
done < "status.txt"
Can anybody help me in creating the dictionary as mentioned above.