Created
April 19, 2018 16:55
-
-
Save cghiban/9db82d6b8933788fad3de518f98ad43c to your computer and use it in GitHub Desktop.
convers long numbers into readable ones
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# usage: | |
# $ echo 1234567|./nicenumber.sh | |
# 1,234,567 | |
# $ find .|wc -l|./nicenumber.sh | |
# 426,704 | |
while read line; do | |
# run the number thru the comma mill | |
echo $line \ | |
|sed '/....$/ s/^\(.*\)\(...\)$/\1,\2/; | |
/....,...$/ s/^\(.*\)\(...,...\)$/\1,\2/; | |
/....,...,...$/ s/^\(.*\)\(...,...,...\)$/\1,\2/; | |
/....,...,...,...$/ s/^\(.*\)\(...,...,...,...\)$/\1,\2/; | |
/....,...,...,...,...$/ s/^\(.*\)\(...,...,...,...,...\)$/\1,\2/' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment