Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

448.Advanced search and replace -- How to replace every 3 instances found in a text file?

User: editor -- 2010-03-15          << 447  449 >>
Hits: 2136
Type: Advanced search and replace   
Search all Advanced search and replace examples
How to replace every 3 instances found in a text file?

I have a text file with many occurrance of 'search', how to replace the 1,4,7,10 instances of 'search' to 'FIND'?
Input Sample:
search and replace
batch search
advanced search
advanced search and replace
replace and search
search binary files
batch search and replace
Output Sample:
FIND and replace
batch search
advanced search
advanced FIND and replace
replace and search
search binary files
batch FIND and replace
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
Replace Pioneer support replace specified occurrance of matched string by "unit number filter".
1. ctrl-o open source text file
2. ctrl-h open 'Replace' dialog
* in 'search for pattern', enter:

* in 'replace with pattern', enter:

* set 'unit number filter' to:

Note: 1<3>N means start from 1, increased with step of 3, until reach the instance N, when N is omitted, will search until reach last instance.
3. click 'Replace', done!
4. ctrl-s save to file
Download Script:  scripts/

Screenshot 1:  Replace_Window

Similar Examples:
How to replace or remove 3 lines randomly in a text file? (76%)
How to replace a number with another number in same text file? (67%)
How to replace the second character of every line to 4 in a text file? (65%)
How to replace a word with a list of words repeatly in a text file? (64%)
How to remove duplicate lines from a text file? (63%)
How to insert a blank line after every 5 lines in a text file? (63%)
How to replace a word/string with increasing sequence number in a text file? (62%)
How to extract all upper cases words from a text file? (62%)

Check Demo of Advanced search and replace
last instance  omit  occurrance  replace pioneer support  increase  found  support  increas  find  unit number filter  replace string with number  replace number in string  start with number  text pattern filter  filter number  pattern filter replace  replace last  text string