Number formatting in BASH with thousand separator

Shiplu Mokaddim picture Shiplu Mokaddim · Feb 21, 2012 · Viewed 18.9k times · Source

I have a number 12343423455.23353. I want to format the number with thousand separator. So th output would be 12,343,423,455.23353

Answer

Ignacio Vazquez-Abrams picture Ignacio Vazquez-Abrams · Feb 21, 2012
$ printf "%'.3f\n" 12345678.901
12,345,678.901