====== 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'