how can i activate dos2unix on files that loacated in google cloud using gsutil?

347 views Asked by At

I have files in my GCP bucket and I am trying to activate dos2unix on those files. I couldn't find (after 1 hour of searching) any commands that allow me that. I try that: gsutil dos2unix gs://my-google-bucket/short_1000rows.csv

but it didn't work. thanks in advance for your help

1

There are 1 answers

0
mhouglum On

GCS objects are immutable (their bytes, not their metadata); you can't change any part of the object without completely replacing it. Aside from operations like rewrite or compose, you have to re-upload an object if you want to change its contents. So, you'll basically have download all the objects, run dos2unix on them, and then re-upload them to your bucket. You may want to make use of gsutil rsync to do steps 1 and 3.