; Invoke with
;
;     emacs -batch -l batch-replace.el target-string replacement-string file
;
; For > 1 file, use foreach at shell.
;


(setq target-string (nth 3 command-line-args))
(setq replacement-string (nth 4 command-line-args))
(setq file (nth 5 command-line-args))

(find-file file)
(replace-string target-string replacement-string)
(save-buffer)