simple question about mv

Leslie Mikesell les at chinet.chi.il.us
Sat Jan 28 15:03:48 AEST 1989


In article <18216 at adm.BRL.MIL> DEG41560 at ua1vm.ua.edu (Rob Smith) writes:
>HI,

> 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

>what does?  I'm under Ultrix 2.2.  I'm doing it by hand, but I'd like to
>be able to do wild card renames, ala DOS.

Unlike DOS file extensions, the '.' is just another character to unix.
How about:  (using /bin/sh)

for i in *.flip
do
mv $i `sed -e 's/flip$/flop'`
done

It might be easier to arrange to have flip and flop subdirectories instead
of using the file suffix since it is a bit easier to:
  mv flip/* flop
and generally no more difficult to construct the full pathname.

Les Mikesell



More information about the Comp.unix.questions mailing list