Find and replace by adding a value
-
Hello everyone!
Well, I have about 4500 files to modify.
Inside, there are lines:
X: 1815
Y: 100
Z: 2225
And I need to modify the values to add values to it.
For example, I need to add “-6096” to X, “-3” to Y and “-3760” to Z to these values, in ALL files (4500+!!).
Which gives new values:
X: 7911
Y: 97
Z:-1535
Do you know if there is a way to do this with notepad++ please?
Thanking you! -
Notepad++ search-and-replace doesn’t do math. So the simple answer is “no”.
But our FAQ on Math Replacements explains how to do it in the PythonScript plugin, if you are able to take example Python code and modify it to do the math you want.
----
Please note: This Community Forum is not a data transformation or free-code-writing service; you should not expect to be able to always say “I have data like X and want it to look like Y” and have us do all the work for you. If you are new to the Forum, and the problem can be easily solved with a regular expression, we’ll likely give you a start on that. And if it requires scripting (more complex logic than can easily be done in a regular expression), we will let you know. If your problem catches the interest of one of the regulars, that person may even provide an example script that may be helpful; often times, we might even ask you to search the forum for a particular term, because that term will likely help you find a script that already implements something similar. Whether it’s a previously-written script, or whether one of us hacks something up for you specifically, it won’t always exactly match your problem, but it’s at least a starting point for you to work from. At that point, you are expected to take the lead, and make any changes to the example that are necessary to convert it from what was provided to something that meets you exact needs. This forum is focused on Notepad++; while you may want to use Notepad++ for the implementation, text editors aren’t always the right tool for complex text transformation tasks: since you are seeing this boilerplate in my reply, it means that I believe that it’s essentially a generic programming challenge, which is off topic for a Notepad++-specific forum.
-
ok! Tanks :)