home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / wxos2240.zip / wxWindows-2.4.0 / distrib / msw / filerepl.bat < prev    next >
DOS Batch File  |  2002-11-10  |  748b  |  29 lines

  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. Rem goto end
  14.  
  15. set len=%@LINES[%files]
  16. do i = 0 to %len by 1
  17.   set line=%@LINE[list.tmp,%i]
  18.   if "%line" == "**EOF**" enddo
  19. rem  echo Cmd: grep %keyword %line
  20.   grep %keyword %line > size.tmp
  21.   if "%@FILESIZE[size.tmp]" == "0" enddo
  22.   sed -f script.tmp %line > file.tmp
  23.   move file.tmp %line
  24. enddo
  25. erase script.tmp
  26. erase list.tmp
  27. erase size.tmp
  28. :end
  29.