Xref: utzoo gnu.emacs.help:1404 comp.emacs:10276 Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!magnus.ircc.ohio-state.edu!tut.cis.ohio-state.edu!unreplyable!garbage From: saito@sdrvx2.sinet.slb.com (Naoki Saito, ISD-002, 203-431-5534) Newsgroups: gnu.emacs.help,comp.emacs Subject: File insertion in a batch mode. Message-ID: <9103081659.AA20200@ASC.SLB.COM> Date: 8 Mar 91 16:59:28 GMT Sender: daemon@tut.cis.ohio-state.edu Followup-To: gnu.emacs.help Organization: Gatewayed from the GNU Project mailing list help-gnu-emacs@prep.ai.mit.edu Lines: 40 Dear, GNU emacs gurus, I would like to use emacs with a batch mode. And what I would like to do is as follows: (1) Find a specific word in the input file. (2) Delete from the top to that word. (3) Insert another file over there. (3) Save that file. I thought it's simple. So I wrote the following function and executed $ emacs input.txt -batch -l ins -f ins -kill But it didn't work. ;;; ;;; ins.el: Insert specific file after the word "Key" ;;; (defun ins () "Delete the top portion of the file to the key and replace by ok.txt." (interactive) (search-forward "Key") (beginning-of-line) (next-line) (kill-region) (insert-file "ok.txt") (save-buffer)) I don't know much about the Emacs lisp. I would appreciate if you could help me to do this kind of simple task. Also I would like to hear whether it's better to do the alternative way without using emacs. Thanks in advance, Naoki Saito (saito@sdr.slb.com) Schlumberger-Doll Research