Newsgroups: comp.unix.wizards Path: utzoo!lsuc!dave From: dave@lsuc.uucp (David Sherman) Subject: Re: simple question about mv Date: Sat, 28-Jan-89 20:35:13 EST Summary: if you like to be sure, edit a script Message-ID: <1989Jan28.203519.3521@lsuc.uucp> References: <18230@adm.BRL.MIL> Organization: Law Society of Upper Canada, Toronto In article <18230@adm.BRL.MIL> moss@BRL.MIL (VLD/VMB) writes: |< 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 |Well, this should work under a Bourne shell: |$ for i in *.flip |> do mv $i `basename $i .flip` .flop |> done |$ Moss's suggestion is the best, once you know what you're doing. For people who are a little scared of such magic before they're fully conversant with sh, it's more comforting to edit a script which has the mv's explicitly. Just use good old ed: $ ls *.flip > junk $ ed junk g/.flip/s/// g/.*/s//mv &.flip &.flop/p w q $ sh -x junk (Personally, I used qed and would say $ qed sh -x Q but not that many people have qed.) 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. David Sherman Toronto -- Moderator, mail.yiddish { uunet!attcan att pyramid!utai utzoo } !lsuc!dave