assign output of awk command to array linux

I have a scenario where I want to store values of command run output to array I have a dat set like below ID|SAL|COST|PER|TAG 1″|”10.1″|”12.22″|”10.1″|”A” 2″|”10.223″|”12.333″|”10.1″|”B” after running the below command I am getting sum of column output as awk -F”|” ‘NR==1{for(i=1;i<=NF;i++){if ($i ~ /SAL|COST/){print i;}}}’ demo.txt 2 3 But the issue is I want…

Details