User Tools

Site Tools


sed:numbering:add_commas_to_numeric_strings

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

sed:numbering:add_commas_to_numeric_strings [2020/08/16 12:26] – created 192.168.1.1sed:numbering:add_commas_to_numeric_strings [2020/08/16 12:28] (current) 192.168.1.1
Line 7: Line 7:
 sed -e :a -e 's/\(.*[0-9]\)\([0-9]\{3\}\)/\1,\2/;ta'  # other seds sed -e :a -e 's/\(.*[0-9]\)\([0-9]\{3\}\)/\1,\2/;ta'  # other seds
 </code> </code>
 +
 +----
 +
 +===== Add commas to numbers with decimal points and minus signs =====
 +
 +<code bash>
 +gsed ':a;s/\(^\|[^0-9.]\)\([0-9]\+\)\([0-9]\{3\}\)/\1\2,\3/g;ta'
 +</code>
 +
  
sed/numbering/add_commas_to_numeric_strings.1597580789.txt.gz · Last modified: 2020/08/16 12:26 by 192.168.1.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki