Community
    • Login

    find the same characthers and replacment incremental value in files in folder

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 3 Posters 422 Views
    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.
    • J
      Jimmy.C_1013
      last edited by

      I have made many serch and still can not get solution
      need a help to guide me how to replace a incremental value in numbers of files

      for example

      in a folder, there is a characters “number” in files.
      I need a help how to do replacement as below

      in file No. 001, named “File_A1.txt”, replace “number” with “Number_1”
      in file No. 002, named “File_A2.txt”, replace “number” with “Number_2”
      in file No. 003, named “File_B1.txt”, replace “number” with “Number_3”
      in file No. 004, named “File_B2.txt”, replace “number” with “Number_4”
      in file No. 005, named “File_C1.txt”, replace “number” with “Number_5”
      in file No. 006, named “File_C2.txt”, replace “number” with “Number_6”
      …
      …
      …
      …
      …
      …
      …
      in file No. 998, named “File_Z1.txt”, replace “number” with “Number_998”
      in file No. 999, named “File_Z2.txt”, replace “number” with “Number_999”

      does anyone have idea ? Regular Expression? Python Script?
      very appreciated with any share.

      datatraveller1D PeterJonesP 2 Replies Last reply Reply Quote 0
      • datatraveller1D
        datatraveller1 @Jimmy.C_1013
        last edited by

        @Jimmy-C_1013 said in find the same characthers and replacment incremental value in files in folder:

        File_A1.txt

        I’m not sure if I have understood:
        Do you want to replace
        File_A1.txt with File_A_1.txt
        ?
        I dont think Notepad++ is a tool for renaming file names.

        1 Reply Last reply Reply Quote 1
        • PeterJonesP
          PeterJones @Jimmy.C_1013
          last edited by

          @Jimmy-C_1013 ,

          If I am understanding correctly, you have hundreds/thousands of files, each with a particular naming scheme. Inside each of these files, you have the word number at least once, and you want to replace that word with part of the filename (extracted from the filename, based on the scheme you mentioned).

          Notepad++ search-and-replace does not have access to the filename, so it cannot be done natively inside Notepad++.

          However, by a clever combination of command-line and Notepad++ manipulation, you may be able to implement something that will work for you. For example, earlier this year someone asked about just inserting the whole filename into their file(s) overtop of a PLACEHOLDER variable in the discussion here – my reply, and the follow-ons, show one way in which this can be accomplished. Using the same command-line portion, and then tweaking the regex to use number instead of PLACEHOLDER should get you pretty close to what you want.

          Good luck.

          ----

          Useful References

          • Please Read Before Posting
          • Template for Search/Replace Questions
          • Formatting Forum Posts
          • FAQ: Where to find regular expressions (regex) documentation
          • Notepad++ Online User Manual: Searching/Regex
          1 Reply Last reply Reply Quote 3
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors