Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pasteur!agate!labrea!lindy!eirik@lurch.stanford.edu From: eirik@lurch.stanford.edu (Eirik Fuller) Newsgroups: comp.unix.wizards Subject: Re: simple question about mv Summary: I like one-liners Keywords: MSDOS: just say no Message-ID: <1846@lindy.Stanford.EDU> Date: 30 Jan 89 07:09:55 GMT References: <18230@adm.BRL.MIL> <1989Jan28.203519.3521@lsuc.uucp> Sender: news@lindy.Stanford.EDU Reply-To: eirik@lurch.stanford.edu (Eirik Fuller) Organization: InterViews/Allegro group, Stanford University Lines: 29 In-reply-to: dave@lsuc.uucp (David Sherman) In article <1989Jan28.203519.3521@lsuc.uucp>, dave@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