I have a task for multiple Replace in Files from a find/replace list being attached as find_replace_list.txt.
There are two strings per line in find_replace_list.txt. First string is the string to find and second string is the replace string. The two strings are separated by two tab characters and the search environment is defined between the tabs.
Here is the search environment list with ≫ as placeholder for the horizontal tab character:
There are two strings per line in find_replace_list.txt. First string is the string to find and second string is the replace string. The two strings are separated by two tab characters and the search environment is defined between the tabs.
Here is the search environment list with ≫ as placeholder for the horizontal tab character:
- ≫≫ ... the string between the tabs is empty:
perlReOn; regExp=true; matchCase=false; matchWord=false; useEncoding=true; encoding=65001; - ≫i≫ ... the string between the tabs is "i":
perlReOn; regExp=true; matchCase=true; matchWord=false; useEncoding=true; encoding=65001; - ≫u≫ ... the string between the tabs is "u":
ueReOn; regExp=true; matchCase=false; matchWord=false; useEncoding=true; encoding=65001; - ≫ui|iu≫ .. the string between the tabs is "ui" or "iu":
ueReOn; regExp=true; matchCase=true; matchWord=false; useEncoding=true; encoding=65001; - ≫r≫ ... the string between the tabs is "r":
regExp=false; matchCase=false; matchWord=false; useEncoding=true; encoding=65001; - ≫ri≫ ... the string between the tabs is "ri":
regExp=false; matchCase=true; matchWord=false; useEncoding=true; encoding=65001;
- Ask to open find_replace_list.txt. The prompt to open the file is not mandatory. It would be okay to open the file already before running the script.
- Ask for file path and file extension.
- Find search environment between tabs in opened file find_replace_list.txt.
- For each line in list file: The date left to the tabbed data is the search string which should be replaced with the string after the tabbed data in all files.
- replace_in_files.zip (193.3 KiB) 78
- ZIP archive contains two input files, the expected output for both input files and the list file.