find the same characthers and replacment incremental value in files in folder
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
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.
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.
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
numberat 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
PLACEHOLDERshould get you pretty close to what you want.