Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!haven!adm!xadmx!moss@BRL.MIL From: moss@BRL.MIL (VLD/VMB) Newsgroups: comp.unix.questions Subject: Re: simple question about mv Message-ID: <18245@adm.BRL.MIL> Date: 30 Jan 89 15:52:39 GMT Sender: news@adm.BRL.MIL Lines: 24 Guy Harris writes: >>Well, this should work under a Bourne shell: >>$ for i in *.flip >>> do mv $i `basename $i .flip` .flop > ... > >Assuming, of course, that all the files are in the current directory, >since "basename" will not only strip off the ".flip", but will also >strip off all the directories leading up to the name (i.e., it will turn >"/usr/src/nemo/cigar.flip" into "cigar", not into >"/usr/src/nemo/cigar"). Well, first off, I made a typo, though I really did test this out first, alas I typed it wrong in the note, it should be: mv $i `basename $i .flip`.flop # note, no space after 2nd ` Secondly, although Guy is correct that this does not work in general, it *does* work as a solution to the original question; how to do: mv *.flip *.flop I actually used 'sed' first which is more general, but thought that this was easier for the novice to understand. -moss