Community
    • Login

    Find and replace question, I need to mutiply a number after a name.

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 1.7k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Jason JamesJ Offline
      Jason James
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • glennfromiowaG Offline
        glennfromiowa
        last edited by

        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.

        1 Reply Last reply Reply Quote 2

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors