Find and replace question, I need to mutiply a number after a name.
-
So I have a text file with very simple formatting for the game Endless Sky. It’s free and open source.
https://endless-sky.github.io/
In the ships file is a list of values, a tab, then a stat in quotes, then a space and a number.
For example:
[tab]“hull” 2000
Each file has a whole bunch of these and I want to change the value at the end by multiplying it. So it would find “hull” and replace 2000 with 4000 if multiplied by 2. Doing it manually every update wouldn’t be remotely reasonable.
-
I have only a passing knowledge of Python, but since no one else has answered, I think Python or another scripting language would be the only way to do what you want in Notepad++ (and it would probably be fairly simple outside of Notepad++ also). Otherwise, it should be fairly trivial for a moderate spreadsheet user to make these changes in Excel, Open Office, or Google Docs - the hardest part would be importing and exporting the file in the correct format.
The only reason I’m not saying Notepad++ is not the tool for the job is that I hear that Notepad++ has the capability to run Python scripts (which I have never used). Otherwise, doing a Find/Replace for each label:value pair, would be rather clunky, and I’d recommend you direct your efforts towards finding a scripting or Excel solution to your problem.
Notepad++ can do some awesome things, but math is probably something it will (rightly) never natively be good at. Hope this helps.