Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!rochester!rutgers!att!alberta!ubc-cs!van-bc!softop!jeff From: jeff@softop.UUCP (Jeff) Newsgroups: comp.unix.questions Subject: Re: simple question about mv Summary: look ma, no forks (well, almost none) Message-ID: <233@softop.UUCP> Date: 4 Feb 89 05:45:58 GMT References: <18231@adm.BRL.MIL> <4093@omepd.UUCP> <626@jonlab.UUCP> Organization: Soft Options, Vancouver, BC. Lines: 32 In article <626@jonlab.UUCP>, jon@jonlab.UUCP (Jon H. LaBadie) writes: > > > An alternative, is one command line to create a list of "root names" > and loop through them. For a large number of files, this could > greatly enhance the efficiency of the processing. Ksh users could > improve upon this even more using the special substitution facilities > of that shell. > > for root in `ls *.flip | cut -d. -f1` > do > mv ${root}.flip ${root}.flop > done > Gee guys, what about csh. I was RTFMing today (yes, and I'll admit it on network postnews) and found ... drum roll ... the :x modifiers. Specifically, :r gives you the root (i.e. no extension) of a symbol. So, I assert (yes folks, no testing), that the following is just what the doctor ordered foreach file-to-be-renamed (*$flip) mv $file-to-be-renamed ${file-to-be-renamed:r}.$flop end And now I wait for the howls of derision. -- ---------------------------------------------------------------------------- | Jeff Tate | 2425 Pandora Street, Vancouver, BC, Canada | | van-bc!softop!jeff | (604) 254-4583 | ----------------------------------------------------------------------------