simple question about mv
Eirik Fuller
eirik at lurch.stanford.edu
Mon Jan 30 17:09:55 AEST 1989
In article <1989Jan28.203519.3521 at lsuc.uucp>, dave at lsuc (David Sherman) writes:
) ...
) $ ls *.flip > junk
) $ ed junk
) g/.flip/s///
) g/.*/s//mv &.flip &.flop/p
) w
) q
) $ sh -x junk
)
) ...
)
) The point is that you can see what the mv commands look like,
) in the editor, before you shovel them at the shell. It's reassuring.
) Note also the sh -x, which lets you watch the commands as they run.
) ...
I agree with the general strategy of constructing commands on the fly
and, when they look right, feeding them to a shell. However, I don't
see the need for a junk file; what's wrong with pipes?
I would have done this as
ls *.flip | sed -e 's/\(.*\)flip$/mv \1flip \1flop/'
When I'm happy with the output (after the usual half-dozen
iterations), I say (in csh)
!! | sh -x
More information about the Comp.unix.wizards
mailing list