Forrest logo
back to the echo tool

echo:ai:12318

Converts 1G to a number in gigabytes
$ echo '1G' | awk '{num=substr($0, 1, length($0)-1); if(substr($0, length($0)) == "G") { printf "%.2fG", num } else { printf "%.2f", num }}'
try on your machine

Converts 1G to a number in gigabytes

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.

Questions that are answered by this command:

  • how can I convert 1G into numbers using a commandline tool exept numfmt in macos?
back to the echo tool