Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!rochester!rutgers!att!ulysses!andante!alice!ark From: ark@alice.UUCP (Andrew Koenig) Newsgroups: comp.unix.questions Subject: Re: simple question about mv Message-ID: <8844@alice.UUCP> Date: 27 Jan 89 22:01:46 GMT References: <18216@adm.BRL.MIL> Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 22 In article <18216@adm.BRL.MIL>, DEG41560@ua1vm.ua.edu (Rob Smith) writes: > I know this is simple, but then again, so am I. What if I want to mv a bunch > of files with the same suffix to another suffix. The following does not > work > > mv *.flip *.flop If you give a bunch of operands to mv, the last one must be a directory and all the others are moved into that directory. Thus the last (in alphabetical order) thing with a name of *.flop becomes the target directory and everything else winds up thee. This is almost surely not what you want. To get what you want, try this: for i in *.flip do mv $i `echo $i | sed 's/flip$/flop/'` done -- --Andrew Koenig ark@europa.att.com