I have a bucket with many objects, and I can successfully use grep to take the specific objects and output them into a text file. I want to use gsutil -rm and read the text file line by line and remove the corresponding object in gcs, but how can I go about doing this?
Or is there a way to directly remove objects from GCS using gsutil -rm and grep? Thanks!
Assuming you output the list of objects to remove to the file remove.txt, you could use this command to remove the named objects:
gsutil -m rm -I < remove.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With