Path: utzoo!utgpu!watmath!clyde!att!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.unix.questions Subject: Re: simple question about mv Message-ID: <7578@chinet.chi.il.us> Date: 30 Jan 89 20:14:59 GMT References: <18216@adm.BRL.MIL> <7558@chinet.chi.il.us> <940@philmds.UUCP> Reply-To: les@chinet.chi.il.us (Leslie Mikesell) Organization: Chinet - Public Access Unix Lines: 30 In article <940@philmds.UUCP> leo@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 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