total_revenue=0

echo "1. Retrieving and Decrypting the encrypted data from storage bucket ..."
# please replace the cloud storage bucket name by your bucket name
gsutil cp --stet gs://USE_YOUR_GCS_BUCKET_NAME/data.txt data.txt

if [[ $? -ne 0 ]];
then
echo "Error retriving data, you must run this on a confidential VM ...exiting..."
exit 1
fi

echo "2. Calculating total revenue ..."

for line in `cat data.txt | cut -d "," -f2-3 | sort -r | grep -v "state"`
do
	revenue=`echo $line| cut -d "," -f2`
	total_revenue=$(( $total_revenue + $revenue ))
done

echo "Total Revenue for 2022 is INR $total_revenue crore"

