Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!husc6!seismo!mcvax!inria!rouaix From: rouaix@inria.UUCP Newsgroups: comp.sys.amiga Subject: Pattern-matching/Scripts Message-ID: <470@inria.UUCP> Date: Tue, 26-May-87 06:00:51 EDT Article-I.D.: inria.470 Posted: Tue May 26 06:00:51 1987 Date-Received: Thu, 28-May-87 04:19:06 EDT Organization: INRIA, Rocquencourt. France Lines: 65 Keywords: EDIT,script,pattern-matching Here comes a new kind of scripts implementing pattern-matching for some simple AmigaDOS commands. You may have noticed that commands like TYPE do not support pattern-matching in the file argument. I would like to do: << type #?.c >> for example. As a replacement, I can now use: execute do type p #?.c or execute do type DEVEL:foo/src/ p #?.(c|asm) Syntax is: execute do [] [p ] which applies the command (that has only one argument) to every file matching the pattern in the directory . Notes: 1) this is going to be slow unless you have the major commands on ram-disk. 2) you need EDIT. (I suppose many of you removed it due to lack of space on the system disk) 3) if you give a directory name, it must end with a ":" or a "/" i.e ram: or sys:s/ 4) the pattern is the same you would have used in << list p >> 5) it is no fun designing command files for EDIT, but since it is the only stream editor with this feature, I am forced to use it. You can easily modify the script to allow commands with more than one argument, or enhance it following your inspiration. 6) may be "execute another_script". Try to write a Unix-like "mv" this way. No Copyright, feel free to distribute . Bugs/comments/flames -> rouaix@inria.inria.fr Final note : use only original AmigaDOS commands for ECHO and CD in scripts. This is it: .key fun/a,direct,p/k failat 20 if "

" eq "" list > ram:_d quick else list > ram:_d p

quick endif if "" eq "" echo > ram:_f "M**;P;D;W" else echo > ram:_f "D;=1;M**;P;D;W" endif echo > ram:_ed "0(A //echo ************File:/;from /ram:_c2/;N;A ,, ,;from;N)" edit from ram:_d to ram:_c with ram:_f ver ram:_v opt p300 if ERROR skip abort endif copy ram:_c to ram:_c2 edit from ram:_c to ram:_ex with ram:_ed ver nil: opt p300 execute ram:_ex skip done lab abort echo "No files" lab done delete > nil: ram:_#?