As part of a case I’m working on I’m regularly wanting to know the exact number of Bytes in N Gigabytes and how many Gigabytes M Bytes are

If you’ve not used Google Calculator before, it’s brilliant.  Just type, for example, “1TB in Bytes” into Google and bam! you have an answer

It is also capable of many other conversions, another example might be “100RMB in GBP” (how much is 100 Chinese yuan worth in Sterling)

The net result is my new gcalc script… it’s a really nasty hack (I can’t see why gawk won’t let me include a + in my field sep. and all attempts to escape it fail)

#!/bin/sh
q=\'echo "$@" | sed 's/ /\\+/g'\'
curl -s -A foo "http://www.google.com/search?q=$q" | gawk -F "font size=\\\\\\\\+1><b>|</b><tr>

In case you’re wondering about the final sed… I don’t like the way Calculator groups numerics in groups of 3… it’s a real pain when you want to copy/paste values quickly

Comments

Nice dude! Google has lots of nice features that m…

Mike - Sep 3, 2008

Nice dude! Google has lots of nice features that most people don’t know about. A common one which is one of my favs is define, eg “define: rabbit”.