I am having a file wherein the data is similar as given below:
abc - $0.05
xyz - $0.01
rst - $0.09
etc - $0.4
What I want to do is, increment all the values by $0.02 so that the final sum will look like below:
abc - $0.07
xyz - $0.12
rst - $0.11
etc - $0.42
How can I achieve this using Notepad++
Thank you.
You can run a python script within the PythonScript plugin.
If it is not yet installed, follow this guide
Create a script (Plugins >> PythonScript >> New Script)
Copy this code and save the file (for example calculate.py
):
import re
def calculate(match):
return '%s' % (str(float(match.group(1)) + 0.02))
editor.rereplace('(\d+\.\d+)', calculate)
Result for given example:
abc - $0.07
xyz - $0.03
rst - $0.11
etc - $0.42
Note the difference from your expected second line (xyz - $0.01
becomes xyz - $0.03
and not xyz - $0.12
)