Skip to content

Instantly share code, notes, and snippets.

@michaelcoyote
Last active May 12, 2022 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelcoyote/226795ff2c089fe29982 to your computer and use it in GitHub Desktop.
Save michaelcoyote/226795ff2c089fe29982 to your computer and use it in GitHub Desktop.
Dumb sed trick for converting GB/MB to bytes..
# Dumb sed trick for converting GB/MB to bytes..
# awk would be better for detail work as you can do math
sed 's/\.[0-9] GB/000000000/' Raw_Status.csv |sed 's/\.[0-9] MB/000000/' | sed 's/0\ bytes/0/' > Cooked_Status.cvs
@dsidirop
Copy link

dsidirop commented Feb 6, 2022

Note that this trick doesn't work when we are dealing with mebibytes = 1024 * 1024 bytes (which is different than the megabyte because that is defined as 1000 * 1000 bytes)

@michaelcoyote
Copy link
Author

michaelcoyote commented May 12, 2022

Sure, this is a hack with sed to give you quick and dirty numbers to work with, please see line 2. YMMV, offer not valid in sectors R and N

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment