अजगर में, आप की तरहEmacs में पाठ की Idiomatic बैच प्रसंस्करण?
fout = open('out','w')
fin = open('in')
for line in fin:
fout.write(process(line)+"\n")
fin.close()
fout.close()
(मुझे लगता है कि यह रूप में अच्छी तरह कई अन्य भाषाओं में समान होगा) कुछ करना हो सकता है। Emacs लिस्प में, आप से Emacs Lisp: Process a File line-by-line
(find-file 'out')
(setq fout (current-buffer)
(find-file 'in')
(setq fin (current-buffer)
(while moreLines
(setq begin (point))
(move-end-of-line 1)
(setq line (buffer-substring-no-properties begin (point))
;; maybe
(print (process line) fout)
;; or
(save-excursion
(set-buffer fout)
(insert (process line)))
(setq moreLines (= 0 (forward-line 1))))
(kill-buffer fin)
(kill-buffer fout)
जो मैं प्रेरणा मिल गया (और कोड) की तरह कुछ करना होगा। या मुझे कुछ पूरी तरह से अलग करने की कोशिश करनी चाहिए? और प्रिंट स्टेटमेंट से ""
को कैसे निकालें?
... शानदार ... – hatmatrix
निम्नलिखित उत्तर पर क्रॉस-रेफरेंसिंग जो दिखाती है कि Emacs स्क्रिप्ट्स को अतिरिक्त कमांड-लाइन तर्क कैसे पारित करें: http://stackoverflow.com/questions/6238331/emacs-shell-scripts-how- टू-डाल-प्रारंभिक-विकल्प-में-स्क्रिप्ट # 6259330 – phils