1834925 Members
2805 Online
110071 Solutions
New Discussion

comma separated numbers

 
SOLVED
Go to solution

comma separated numbers

Can someone send me a sample script of how to print comma separated numbers in a Kornshell script?
4 REPLIES 4
Pete Randall
Outstanding Contributor

Re: comma separated numbers

Alessandro Pilati
Esteemed Contributor
Solution

Re: comma separated numbers

Matthew,
try also this:

echo XXXXXX|sed -e :a -e 's/\(.*[0-9]\)\([0-9]\{3\}\)/\1,\2/;ta'

where XXXXXX is your number.


Hope this helps,
Alessandro
if you don't try, you'll never know if you are able to

Re: comma separated numbers

Thanks to Alessandro, quick and easy and I'm on my way.

Thank you also, Pete. I've been searching for a similar thread for ages, but never thought to use the word separator instead of commas.

Re: comma separated numbers

Alessandro's solution fit the bill perfectly.