#!/bin/bash
aws s3api list-object-versions --bucket bucketName --prefix prefixName --output text | grep "DELETEMARKERS" | while read obj
do
KEY=$( echo $obj| awk '{print $3}')
VERSION_ID=$( echo $obj | awk '{print $5}')
echo $KEY
echo $VERSION_ID
aws s3api delete-object --bucket app-pocket --key $KEY --version-id $VERSION_ID
done