Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
IFS=.
A=1234567.1234
B=123456789123.1234
C=123456789.15
function format_nr {
INT=$1
DEC=$2
RESULT=''
while [[ -n $INT ]]
do
typeset -R3 INT3=$INT
RESULT="${INT3},${RESULT}"
INT=${INT%%(???|??|?)}
done
echo ${RESULT%%,}.$2
}
format_nr $A
format_nr $B
format_nr $C
IFS=.
A=1234567.1234
X=1234567
B=123456789123.1234
C=123456789.15
function format_nr {
INT=$1
DEC=$2
#if no decimals, add '.00'
if [[ -z "$DEC" ]]
then
DEC='00'
fi
RESULT=''
while [[ -n $INT ]]
do
typeset -R3 INT3=$INT
RESULT="${INT3},${RESULT}"
INT=${INT%%(???|??|?)}
done
echo "${RESULT%%,}.$DEC"
}
format_nr $B
format_nr $C
format_nr $X
IFS=.
A=1234567.1234
X=1234567
B=123456789123.1234
C=123456789.15
function format_nr {
INT=$1
DEC=$2
#if no decimals, add '.00'
#if [[ -z "$DEC" ]]
#then
# DEC='00'
#fi
RESULT=''
while [[ -n $INT ]]
do
typeset -R3 INT3=$INT
RESULT="${INT3},${RESULT}"
INT=${INT%%(???|??|?)}
done
if [[ -z "$DEC" ]]; then
echo "${RESULT%%,}"
else
echo "${RESULT%%,}.$DEC"
fi
}
format_nr $A
format_nr $B
format_nr $C
format_nr $X
IFS=.
X=1234567
B=123456789123.1234
C=123456789.15
function format_nr {
INT=$1
DEC=$2
#if [[ -z "$DEC" ]]
#then
# DEC='00'
#fi
RESULT=''
while [[ -n $INT ]]
do
typeset -R3 INT3=$INT
RESULT="${INT3},${RESULT}"
INT=${INT%%(???|??|?)}
done
if [[ -z "$DEC" ]]; then
RESULT="${RESULT%%,}"
else
RESULT="${RESULT%%,}.$DEC"
fi
echo "${RESULT##( | | )}"
}
format_nr $X
format_nr $B
format_nr $C
#!/bin/ksh
A=1234567
B=123456789123.1234
C=123456789.15
D=.1234
function format_nr {
INT=${1%.*}
DEC=${1#${INT}}
RESULT=""
while [[ -n $INT ]]
do
typeset -R3 INT3=$INT
RESULT="${INT3},${RESULT}"
INT=${INT%%(???|??|?)}
done
print ${RESULT%,}${DEC}
}
format_nr $A
format_nr $B
format_nr $C
format_nr $D
#!/bin/bash
#
# comma-insert.sh
# Usage: df | comma-insert.sh for example
#
rev | sed 's/\([0-9][0-9][0-9]\)\([0-9]\)/\1,\2/g' | rev