You need the following jars
jawk.jar
regex12.jar
Write a batch file as follows
set pattern1="abc"
set pattern2="xyz"
set tempfile=c:\temp.txt
dir /b /s c:\dir\*.jsp
| java com.ai.jawk.CmdSubst @call gres.bat $1 %pattern1% %pattern2% %tempfile%
> execjsp.bat
@call execjsp.bat
This is what it does
- List all jsp files in that directory hierarchy
- For each line execute "gres.bat" with 4 arguments
- gres.bat replaces patter1 with pattern2 in file $1 which is the first argument from the previous pipe. It uses a tempfile in the process
- All the executable commands are collected in "execjsp.bat"
- As a final step execute the command
- You will have an entire directory/sub-directory worth of files replaced with the pattern