Search code examples
textnumbersdividecalc

Calculating all number from a text file (division)


I have a file or a text which contains huge numbers. This is how it looks:

2622256647732477952, 3146707977278973440, 3776049572734768128, 4531259487281721344, 5437511384738065408, 6525013661685678080, 7830016394022813696, 9396019672827375616, 11275223607392849920, 13530268328871419904, 

I want to divide every number by the factor of 100. Is there any fast way to do this? notepadd++ maybe? or any 3rd party editor which is able to do such stuff?

It's around 1000 numbers would be pretty time consuming to do this manually.


Solution

  • All the numbers seem to be integers. If that is true, and if they are all above 100 (the divisor), why not just use a regular expression to insert a decimal point in every number.

    In Notepad++ try: Search string: (\d+)(\d{2}) Replace string: $1.$2

    Check "Regular expression" box and hit "Replace all".

    Edit:

    In the special case you mention in your comment, where the decimals should just be disregarded, you can simply use (\d+)\d{2} as search string and $1 as the replace string. Note that the result won't be rounded to the nearest integer though (11189 should become 112 really, but you'll get 111).

    Other options include importing the string into Excel or other spreadsheet software and use a formula in there, writing a javascript snippet to split the string up and divide each number etc.