Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

369.Regular expression replace -- How to batch replace the last 5 "old" with "new" in a text file?

User: editor -- 2009-12-18          << 368  370 >>
Hits: 1608
Type: Regular expression replace   
Search all Regular expression replace examples
I have a text file with many words such as "old", I just want to replace the last 5 "old" into new words like "new", how to replace it using regular expression?
Input Sample:
1111 old old
2222 old old
3333 old old
4444 old old
5555 old old
Output Sample:
1111 old old
2222 old old
3333 old new
4444 new new
5555 new new
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open source text file
2. ctrl-h open replace window
in search for pattern, fill:

in replace with pattern, fill:

3. click 'Replace', ok.
4. ctrl-s save the file.
Download Script:  scripts/

Screenshot 1:  Replace_Window

Similar Examples:
How to batch replace 'old' to 'new' in many pdf files? (70%)
How to batch replace 'old' to 'new' in many word doc files? (67%)
How to batch remove/delete first and last line of many text files? (65%)
How to batch replace files and save the result to new files? (63%)
How to batch rename last part of filenames to the strings from a file? (63%)
How to count the occurrence of a list of words in a text file? (63%)
How to add spaces to align text to the center in a text file? (63%)
How to make a batch replacement according to a text mapping file? (63%)

Check Demo of Regular expression replace
many word  any word  the last  last  regular expression  las  expression  regular  regula  regular exp  regular expression replace last  batch search for words in a text file  replace batch many words  replace words in text with batch  batch regular expression text  batch replace regular expression  batch regular expression replace  regular expression in batch