title: Replace line in aws cli output with sed
body: <p>I have a script that I wrote that deletes AWS snapshots. I want to remove part of the output when a snapshot doesn't exist.</p>
  
  <p>In this output:</p>
  
  <pre><code>Deleting unused snapshots in AWS Gov Non Prod
  *****************************************************************
  deleting snapshot: snap-0b571b64784bac904
  
  An error occurred (InvalidSnapshot.NotFound) when calling the DeleteSnapshot operation: The snapshot 'snap-0b571b64784bac904' does not exist.
  *****************************************************************
  
  
  *****************************************************************
  Verify that snapshot: snap-0b571b64784bac904 is gone:
  
  An error occurred (InvalidSnapshot.NotFound) when calling the DescribeSnapshots operation: The snapshot 'snap-0b571b64784bac904' does not exist.
  *****************************************************************
  </code></pre>
  
  <p>I want to remove just the phrase: "An error occurred (InvalidSnapshot.NotFound) when calling the DescribeSnapshots operation:" and leave the phrase: The snapshot 'snap-0b571b64784bac904' does not exist.</p>
  
  <p>In my script I tried adding sed to remove what I don't want:</p>
  
  <pre><code>aws ec2 delete-snapshot --snapshot-id=$i --profile=govcloud-nonprod | sed -e 's/An error occurred (InvalidSnapshot.NotFound) when calling the DeleteSnapshot operation: //g'
  </code></pre>
  
  <p>This is my script in its entirety:</p>
  
  <pre><code>    #!/bin/bash
  
  echo "Deleting unattached volumes in AWS Lab"
  
  for i in $(cat aws_lab_volumes.txt)
  do
    echo "*****************************************************************"
    echo "deleting volume: $i"
    aws ec2 delete-volume --volume-id=$i --profile=lab | sed -e 's/An error occurred (InvalidVolume.NotFound) when calling the DeleteVolume operation: //g' 2&gt;/dev/null
    echo "*****************************************************************"
    echo; echo; echo; echo; echo
    sleep 5
    echo "*****************************************************************"
    echo "Verify that volume: $i is gone:"
    aws ec2 describe-volumes --volume-ids=$i --profile=lab | sed -e 's/An error occurred (InvalidVolume.NotFound) when calling the DescribeVolumes operation: //g' 2&gt;/dev/null
    echo "*****************************************************************"
    echo; echo; echo; echo; echo
  done
  </code></pre>
  
  <p>So basically the sed line is failing. How can I use sed to remove just the part I don't want?</p>