![]() |
shortway to parse numbers with commas in bash?
anyone know a shortway to parse numbers with commas in bash?
ex: 1000 becomes 1,000 and so on this is what im using, it works, but wondering if theirs anything shorter Code:
echo 10000 | sed -r ':L;s=\b([0-9]+)([0-9]{3})\b=\1,\2=g;t L' |
Code:
i=10000; printf "%'0.0d\n" $i |
crap you beat me to it.. :thumbsup
Code:
echo 1000 | xargs printf "%'0.0d\n" |
| All times are GMT -7. The time now is 09:00 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123