User: editor -- 2013-07-10 << 1100 1102 >> |
Hits: 3830 |
Type: Text generator |
Search all Text generator examples |
Description: |
How to generate files from template file, where some variables come from a list? I have a text file (mytxt.txt) containing sometext and VAR1, VAR2, VAR3 I have file list.txt containing 100*3 words cat,bat,hat dog,hog,cog ... For each first word(on each line) I wish to create a text file e.g. cat.txt,dog.txt etc. which is a copy of mytxt.txt where: VAR1 is replaced with the first word cat VAR2 is replaced with the second word bat VAR3 is replaced with the third word hat |
Input Sample: |
mytxt.txt: .......VAR1 ....VAR2 ....... ....VAR3 list.txt: cat,bat,hat dog,hog,cog ... |
Output Sample: |
cat.txt ........cat ....bat ....... ....hat dog.txt: .......dog ....hog ....... ....cog ... |
Answer: |
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
1. ctrl-o open list.txt 2. ctrl-h open 'replace' dialogue * set 'replace unit' to 'Line' * click 'advanced' tab, set 'run following for each matched unit' to: 3. click 'replace', all files will be generated under d:\test\folder. Note: assume mytxt.txt is under d:\test\ folder. |
Screenshot 1: Replace_Window |
Screenshot 2: Replace_Advanced_Window |