Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

318.Advanced search and replace -- How to create a serial files from a template file with "_TAG_" replaced by different strings?

User: Nick Makris -- 2009-02-16          << 317  319 >>
Hits: 611
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
I need to replace a constant text, "_TAG_", that appears in a single template file with each occurance of a string value that found in a second file. This second file lists out tall the strings on separate lines. I would like to create a separate output file for each substitution that was made.
Input Sample:
_TAG_
Output Sample:
1234567
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
Assume template file is d:\mydata\template.txt
Second file is strings.txt
1. Import strings.txt into system dictionary
1) ctrl-o open strings.txt
2) ctrl-h open replace dialog
* set "replace unit" to "Line"
click Advanced page:
* set "Run following at the beginning of replace" to:

* set "Run following for each matched unit" to:

3) click "Replace", strings.txt will be load into system.

2. Create subsititution files

1) Assume strings.txt has 123 lines, create a new file a.txt
 with 123 lines, each line is full path name of your  template file:

2) Open "Tools->Batch Runner" menu, click "Import List" to import a.txt
3) Change "Set output filename" to output file like: out_###.txt
4) Click "Fast Replace"  then click "Add":
* enter "Search": 
* enter "Replace": 
* click "OK"
5) Click "Start", Done!

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Advanced_Window


Screenshot 3:  Fast_Replace_Window


Similar Examples:
How to generate a csv file from a template file and a list of words? (61%)
How to convert many html files to text files with "fast replace" function? (55%)
How to save specified lines of text file into different files? (53%)
How to change all numbers in a text file to 2 decimial places? (50%)
How to change all numbers in a text file to the comma separated numbers? (50%)
How to replace strings in multiple files with a global  increasing ID? (49%)
How to rename all the files by adding the file size after filename? (49%)
How to search specified pattern in a text file and remove spaces in it? (49%)

Check Demo of Advanced search and replace
Keywords:
mad  occurance  123  total  dictionary  diction  found  system  path  toc  line serial  create files from template  output found text  separate string text  output found  strings in a line  strings files  create files