Gentlemen, thanks all for your comments. Before I posted I knew the thousands separator was problematic for the reasons stated by Simon. I figured it was intentionally left out of sqlite's printf(). I wanted to make sure I was not missing a known or easy solution.
As sqweek/Mohit suggested I will attempt a post processing/function solution. I did not go that route to begin with as I was concerned about performance and an extension seems cleaner. www.sqlite.org/loadext.html states that: "Loadable extensions are C-code." Can someone confirm this please. If I figure out some clever I will share for the benefit of other shell junkies that like neat easily readable numeric output - all 6 of us :) On Mon, Nov 23, 2015 at 5:18 AM, Mohit Sindhwani <ml3p at onghu.com> wrote: > On 23/11/2015 11:32 AM, Rowan Worth wrote: > >> Hi Bruce, >> >> I had a go at post-processing the sqlite3 shell's output to apply thousand >> separators. I don't recommend looking too hard at the sed for the sake of >> your sanity, but the gist is it repeatedly prepends a comma to trailing >> groups of three digits, and then repeatedly removes commas which appear >> after a decimal point[1]. >> > > I thought that it should be "easy enough" to add a custom function that > outputs the formatted view for numbers... so, instead of > > select int_val > you could do: > > select to_thousands_formatted(int_val) > with an optional parameter that says how you want it separated "," being > the default. > > It would be a bit like using upper(X) with a syntax that uses parameters > like group_concat() does. Would that not work? In that case, this > pretty_printer coule be code only within the sqlite3 shell (or as an > extension, it could be in anything). > > Best Regards, > Mohit. > > > > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users >