Path: utzoo!mnetor!uunet!lll-winken!lll-crg.llnl.gov!bowles From: bowles@lll-crg.llnl.gov (Jeff Bowles) Newsgroups: comp.unix.questions Subject: Re: Need a file renaming facility Message-ID: <6537@lll-winken.llnl.gov> Date: 27 Apr 88 14:53:30 GMT References: <3564@fluke.COM> Sender: usenet@lll-winken.llnl.gov Reply-To: bowles@lll-crg.llnl.gov.UUCP (Jeff Bowles) Organization: Lawrence Livermore National Laboratory Lines: 25 Hmm. Hard to do directly, without hacking the shell's view of metacharacters. Perhaps you want something like this: rename '\(.*\).f' *.f in which the expression is something normally given to expr(1). Such a script would follow this form: #!/bin/sh ex=$1 shift for f in $* do newf=`expr $f : "$ex"` mv $f $newf done Of course you'd embellish this, make it possible to pass flags to the mv(1) command, and provide for files with "#" in the name, but I submit that to ignore the existing tools would not only waste your time, but run the risk of making a new tool that doesn't fit in well with the existing ones. [ "Isn't it neat when you can spell your name with the different flags you've added to a command?" - overheard at a Usenix a while back.] Jeff Bowles