Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

902.Advanced search and replace -- How to add a page number after every 40 lines in a text file?

User: editor -- 2012-01-11          << 901  903 >>
Hits: 3548
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
How to add a page number after every 40 lines in a text file?
Input Sample:
line1 
line2 
... 
line40 
line41 
... 
line80 
...
Output Sample:
line1 
line2 
... 
line40 
--------- page1 ------- 
line41 
... 
line80 
--------- page2 ------- 
... 
...
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open the source text file 
2. ctrl-h open 'replace' dialog 
* set 'search for pattern' to: 
 
* set 'unit number filter' to: 
 
* set 'replace with pattern' to: 
 
3. click 'replace', done. 
4. ctrl-s save to file 
 
Note:  
above operation is to add a page number after the 40th,  
80th, 120th... line.  
unit number filter 40<40> means 40,80,120,... (syntax m<n>  
means m, m+n, m+n+n, m+n+n+n, ...)

Screenshot 1:  Replace_Window


Similar Examples:
How to add a blank line after every 8 lines in text file? (79%)
How to add the numbers together in every 2 adjacent lines in text file? (76%)
How to add 3 spaces after every 9 characters in a text file? (75%)
How to insert a blank line after every 5 lines in a text file? (72%)
How to delete duplicate numbers in every line in text file? (69%)
How to add sequence number for each non-blank line of a text file? (67%)
How to add h2 tag for all sub-title lines in text file? (66%)
How to randomly deletes x number of lines from text files? (65%)

Check Demo of Advanced search and replace
Keywords:
syntax  tax  unit number filter  page number  number filter  operation  after  every  filter  very  add lines every lines  add line every lines  add page number  after number  add text every line  add text to every line  add number to lines  add line after