0

How to format line counts after sort and uniq add thousand separator

Sample Input:

1000 A
3000 B

Output:

1,000 A
3,000 B
Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250

1 Answers1

1

Using numfmt from GNU Coreutils:

printf '1000 A\n3000 B\n' | numfmt --field=1 --grouping
1,000 A
3,000 B

The result that you get may depend on your locale.

steeldriver
  • 78,509
  • 12
  • 109
  • 152