I can think of a lot of apps better suited for doing simple math than a text editor
Possibly, but I'm not suggesting you fire up TextMate just to do a calculation.
Why not save the output as text and import it into Excel?
Hmmm, slick native editor I spend all day in or a big hulking spreadsheet app that eats up a ton of memory and has little value to me. Is this a trick question? :)
Plus as others have already pointed out, there are plenty of shell commands to do this
Calculating log files was just a contrived example. A convenient set of numbers.
In fact, if you're going to use that much Ruby code to format it, why not just do the whole thing in a one liner?
I don't quite follow. The Ruby code is shorter from what I see. The function definition bit isn't needed:
by Scott Stevenson — Dec 20
Possibly, but I'm not suggesting you fire up TextMate just to do a calculation.
Why not save the output as text and import it into Excel?
Hmmm, slick native editor I spend all day in or a big hulking spreadsheet app that eats up a ton of memory and has little value to me. Is this a trick question? :)
Plus as others have already pointed out, there are plenty of shell commands to do this
Calculating log files was just a contrived example. A convenient set of numbers.
In fact, if you're going to use that much Ruby code to format it, why not just do the whole thing in a one liner?
I don't quite follow. The Ruby code is shorter from what I see. The function definition bit isn't needed:
st.to_s.gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1,")
Maybe I missed your point?