]>
Commit | Line | Data |
---|---|---|
3ca6a5f0 BP |
1 | @echo off |
2 | Rem Replace a string with another string in the given files. | |
3 | Rem The first argument is the string to be replaced. | |
4 | Rem The second argument is the replacement string. | |
5 | Rem The third argument is a file listing the files to be processed. | |
6 | ||
7 | set keyword=%1 | |
8 | set repl=%2 | |
9 | set files=%3 | |
10 | echo s/%keyword/%repl/g > script.tmp | |
11 | ||
12 | call %wxwin\distrib\msw\expdwild.bat %3 list.tmp | |
13 | ||
14 | set len=%@LINES[%files] | |
15 | do i = 0 to %len by 1 | |
16 | set line=%@LINE[list.tmp,%i] | |
17 | if "%line" == "**EOF**" enddo | |
18 | rem echo Cmd: grep %keyword %line | |
19 | grep %keyword %line > size.tmp | |
20 | if "%@FILESIZE[size.tmp]" == "0" enddo | |
21 | sed -f script.tmp %line > file.tmp | |
22 | move file.tmp %line | |
23 | enddo | |
24 | erase script.tmp | |
25 | erase list.tmp | |
26 | erase size.tmp | |
27 | :end |