In bash, if an element in an array is found to contain a K
, I want to multiply that element by 1000 and set that element to the product.
for i in "${stats_array[@]}"
do
if echo "$i" | grep -q K; then
# set that value to that value times 1000
fi
done
How is this accomplished in a bash script?
My array might look like:
stats_array: 1, 54, 54K, 99
And I want it to look like:
stats_array: 1, 54, 54000, 99