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: 362
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
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
Answer:
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/448.rst.zip

Screenshot 1:  Replace_Window


Similar Examples:
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 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%)
How to duplicate every letter of a-z and A-Z in a text file? (62%)
How to join every n lines into 1 line in a text file? (62%)

Check Demo of Advanced search and replace
Keywords:
occurrance  increase  replace pioneer support  found  support  increas  find  unit number filter  number filter  string  text pattern filter  filter number  how to replace a string  replace a string  replace string  replace last  a string  pattern filter replace