marc@ucbvax.BERKELEY.EDU (Marc Teitelbaum) (04/29/88)
I was waiting for someone else to post this, but... Although i hardly ever use it (i tend to use shell loops like those previously suggested), there was a command posted to net.sources a while back which does just the sort of transformation on shell-like file globed lists you need, and in a generalized way. I include the (semi-literate) man page at the end. If anyone wants code i'll post to comp.sources.unix. Marc ----------- Marc Teitelbaum 457 Evans Hall Computer Systems Research Group - CSRG University of California Berkeley, CA 94720 ================================= NAME mkcmd - expand complicated global commands SYNOPSIS mkcmd commandstring > shellfile mkcmd commandstring | sh DESCRIPTION There is now a command to do those impossible wild card requests like rename everything which ends with ".ftn" to end with ".f4p" . This is done by: % mkcmd "mv *.ftn #.f4p" > file % sh file mkcmd generates a command file on its std output which can be examined on your terminal, redirected into a command file, or piped directly into the shell. '#' is the new special character introduced with mkcmd. It represents the string matched by '*,[],or ?' . If there are more than one wild card specifications in the file name, they may be referenced by '#1', '#2', ..., '#9'. e.g.: % mkcmd "mv *.[cs] #1.#2.old" >file will generate a command file which will add the extension ".old" to all files which end either ".c" or ".s" . '#1' represents the string matched by the '*' and '#2' represents the character matched by the '[cs]' . '?' is also allowed and matches any single character. '#0' represents the logname of the owner of the file matched. e.g.: % mkcmd "/tmp/* is owned by #0" will give a listing of all files in /tmp and their owners.
gsarff@ssdis.UUCP (gary sarff) (05/02/88)
I would very much like the mkcmd program you mentioned if you could post it to the sources archives sometime. It would be very useful. -- Gary Sarff {uunet|ihnp4|philabs}!spies!ssdis!gsarff To program is human, to debug is something best left to the gods. "Spitbol?? You program in a language called Spitbol?" The reason computer chips are so small is that computers don't eat much.