perl -pe's!(^|\s)(\d{4,})(?=\s)!sprintf"$1%s".(($x=-4+length$2)%3?" %.0f":"%.1f").(qw(M G T))[$x/=3]," "x$x,$2/1024**int$x+1!ges'