Help for this page

Select Code to Download


  1. or download this
    echo "$NUM" | sed -r ':a;s/^([-+]?[0-9]+)([0-9]{3})/\1,\2/;ta'
    
  2. or download this
    # This function inserts commas into numbers at every 3 digits
    # and returns the result in a global variable called $STR.
    ...
        STR="$PREFIX$NUM$SUFFIX"
      fi
    }