sed:change:add_commas_to_numeric_strings
SED - Change - Add commas to numeric strings
Change “1234567” to “1,234,567”.
gsed ':a;s/\B[0-9]\{3\}\>/,&/;ta' # GNU sed sed -e :a -e 's/\(.*[0-9]\)\([0-9]\{3\}\)/\1,\2/;ta' # other seds
Add commas to numbers with decimal points and minus signs
gsed ':a;s/\(^\|[^0-9.]\)\([0-9]\+\)\([0-9]\{3\}\)/\1\2,\3/g;ta'
sed/change/add_commas_to_numeric_strings.txt · Last modified: 2020/08/16 12:28 by 192.168.1.1