Linux Bash - Formatting "wc - l" output with thousand separators

34 views Asked by At

Thanks for your patience with this beginner. I've googled this seemingly easy task for hours without luck. I apologize in advance if I'm using the wrong terminology.

I'm trying to insert thousand separators into the standard output of wc -l:

Current Output:
1000  one.txt
2000  two.txt
1000  three.txt
4000  total

Desired Output:
1,000  one.txt
2,000  two.txt
1,000  three.txt
4,000  total

I'm able to use printf ""%'d"" in other scenarios when I simply want the count and not the filename. But in this scenario I also need the filename.

Thank you for your time.

0

There are 0 answers