I'm filling up an array from bash like this:
array[0]=$(awk '/Item/' logfile.log | awk '{print $21}' | awk -F'"' '{ print $2 }')
array[1]=$(awk '/Item/' logfile.log | awk '{print $26}' | awk -F'"' '{ print $2 }')
array[2]=$(awk '/Item/' logfile.log | awk '{print $31}' | awk -F'"' '{ print $2 }')
For some I get a value as a digit for others, there is no output so I believe this populates the array elements with a NULL.
I want to find the array elements that contain NULL and fill them with "0"
I have tried a few different things, but I can't seem to find the correct method here.
One thing I tried:
if [[ ${array[$i]} ]]; then array[$i]=0;fi
I think I'm missing qoutes or brackets but just can't seem to hit on the correct syntax.
Thanks