Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

830.Replace text in multiple files -- How to search and replace in multiple files base on user-defined mapping file?

User: tang jin fei -- 2011-08-01          << 829  831 >>
Hits: 3446
Type: Replace text in multiple files   
Search all Replace text in multiple files examples
Description:
Hi, I have some files with special format chars in them like a1234, b5678, etc. I have a mapping file like this: 
a1234 
xxxx 
b5678 
yyyy 
(they are separated by \n) 
I wish to replace the many a1234s and b5678s with xxxx and yyyy in multiple files. Can anyone please tell me?
Input Sample:
file1: 
....a1234 
file2: 
....b5678 
mapping file: 
a1234 
xxxx 
b5678 
yyyy
Output Sample:
file1: 
....xxxx 
file2: 
....yyyy
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
Firstly, you need to convert the mapping file to following format: 
 
1. ctrl-o open mapping file 
2. ctrl-h open 'replace' dialog 
* set 'search for pattern' to: 
 
* set 'replace with pattern' to: 
 
3. click 'Replace', done. 
4. ctrl-s save to a file like rule.txt 
 
Secondly, you can import rule.txt and replace multipe files 
5. open "Tools->Batch Runner" menu 
6. drag multiple text files to "Batch Runner" window 
7. click "Fast Replace" to open "Fast Replace" dialog 
* click "Import" to import "rule.txt" 
8. uncheck "reg exp" option if you only need fixed string replace. 
9. click "Start", done.

Screenshot 1:  Replace_Window


Screenshot 2:  Fast_Replace_Window


Similar Examples:
How to replace strings in multiple files based on the search/replace mapping file? (75%)
How to search/replace multiple text files base on rules from csv file? (74%)
How to extract and join text from multiple files with user defined format? (66%)
How to search and replace multiple file with multiple regex rules? (65%)
How to search and replace multiple terms with 1 common term in text file? (64%)
How to search replace multiple files with distinct search replace definition for each? (63%)
How to replace strings in multiple files with a global  increasing ID? (63%)
How to batch rename files by a filename mapping list? (63%)

Check Demo of Replace text in multiple files
Keywords:
multipe files  1234  yyyy  123  special  tel  mapping  mapping file  fixed  define  search replace by mapping  search and replace by mapping file  search replace mapping  replace some string  format many files  multiple chars  replace string in multiple files  replace string multiple file