Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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
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)

Copy link

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