From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: gnuist006@hotmail.com (gnuist006) Newsgroups: gmane.emacs.help Subject: Re: A very simple question on SED or AWK for a GURU, possibly a lisp script or emacs batch processing of many files Date: 14 Jan 2003 00:42:05 -0800 Organization: http://groups.google.com/ Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1042533925 10188 80.91.224.249 (14 Jan 2003 08:45:25 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 14 Jan 2003 08:45:25 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18YMhH-0002eC-00 for ; Tue, 14 Jan 2003 09:45:24 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18YMhO-000210-03 for gnu-help-gnu-emacs@m.gmane.org; Tue, 14 Jan 2003 03:45:30 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews1.google.com!not-for-mail Original-Newsgroups: gnu.misc.discuss,comp.lang.lisp,gnu.emacs.help,comp.unix.shell Original-Lines: 50 Original-NNTP-Posting-Host: 209.178.179.185 Original-X-Trace: posting.google.com 1042533726 7080 127.0.0.1 (14 Jan 2003 08:42:06 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: 14 Jan 2003 08:42:06 GMT Original-Xref: shelby.stanford.edu gnu.misc.discuss:79554 comp.lang.lisp:102965 gnu.emacs.help:108936 comp.unix.shell:139587 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:5464 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:5464 The main group for followup to this is: comp.unix.shell or gnu.emacs.help depending on the type of solution. I hope that I have the relevant groups for cross-posting. ---- Even though the problem posed in this thread is still *** UNSOLVED *** let me extend my gratitude to Mr Christofer and Friedrich for their kind attempts to answer this. I hope for some more help tonight. Mr Friedrich's reply uses perl. I am not familiar with this language. Also I prefer not to generate very many intermediate files since I have to process a large number of them. I also want to use bash/sed/awk instead of perl. I can write a bash wrapper loop but what I do not know here is how to implement the core logic of replacing an indefinite number of forward-slashes within a pattern of interest. On the other hand for a lisp based solution I CAN write a macro or a lisp function to do the core logic in lisp inside emacs by myself using narrow and widen or transient mode. But here what I do not know is how to load one file after another and then save it to a new name and close that buffer. Please just show me how to do a bunch of files in this way. I can generate the file names like this in bash: for i in `du -a directory | grep file.txt | sed to remove some junk from du`; do core logic done Thanks a lot and do not forget to have fun working on this problem. It is a little out of the way. Gnuist BTW there is a disjoint thread on this subject in comp.unix.shell and there have been no useful replies as you can see.