How to use Awk to format numbers with a thousands separator
13
votes
4
answers
18891
views
Can anyone tell me how to use the awk command for this statement "the number will contain commas after every three digits. For example, 100000000 will become 100,000,000."
I know how to use sed command to obtain this output but I don't know how to use awk, I'm beginner please tell me I'm searching from morning but I didn't get a suitable answer for this so please suggest me best tutorials for learning.
sed command to get the above output:
echo "100000000" | sed -E 's/([0-9]{3})/,\1/2g'
Asked by Error3735
(155 rep)
Dec 13, 2015, 05:51 PM
Last activity: Aug 28, 2024, 05:50 AM
Last activity: Aug 28, 2024, 05:50 AM