simple question about mv
Leslie Mikesell
les at chinet.chi.il.us
Tue Jan 31 06:14:59 AEST 1989
In article <940 at philmds.UUCP> leo at philmds.UUCP (Leo de Wit) writes:
>|for i in *.flip
>|do
>|mv $i `sed -e 's/flip$/flop'`
>|done
>
>You probably meant here:
>
>mv $i `echo $i|sed -e 's/flip$/flop/'`
>
>As it stands, the sed command has no input (well, not what you expect
>it to have), and the sed expression contains a syntax error.
Oops, I even tested that and then mistyped it. What I actually would
have done myself (assuming that it doesn't need to be done often enough
to be worth writing a shell script) is:
vi
:r !ls *.flip
:%s/.*/& &/
:%s/flip$/flop/
:%s/^/mv /
:w !sh
:q!
This lets me check my notoriously poor typing before anything actually
happens and each step can be undone with the <u> command if it doesn't
look right. Now, how many people have a vi manual that documents the
difference between :w! file and :w !command ?
Les Mikesell
More information about the Comp.unix.questions
mailing list