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