Article View: comp.unix.shell
Article #1090Re: How to do mv *.xyz *.abc in shell script??
From: Chet Ramey
Date: Fri, 07 Sep 1990 17:55
Date: Fri, 07 Sep 1990 17:55
25 lines
1128 bytes
1128 bytes
changing *foo to *bar
>in csh it's even easier
>
>foreach i ( *foo )
> mv $i {$i:r}.bar
>end
In bash or ksh, it's just as easy:
cwns1$ ls
1.foo 2.foo 3.foo 4.foo 5.foo 6.foo 7.foo 8.foo 9.foo
cwns1$ for i in *.foo
> do
> mv $i ${i%.*}.bar
> done
cwns1$ ls
1.bar 2.bar 3.bar 4.bar 5.bar 6.bar 7.bar 8.bar 9.bar
Chet
--
Chet Ramey ``Levi Stubbs' tears run down
Network Services Group his face...''
Case Western Reserve University
chet@ins.CWRU.Edu
Technical Details
Message-ID:
<1990Sep7.175536.19931@usenet.ins.cwru.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!uflorida!ukma!usenet.ins.cwru.edu!cwns1!chetReferences:
<5569@minyos.xx.rmit.oz> <975@ria.ccs.uwo.ca> <1990Sep7.153055.6629@msi.umn.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!uflorida!ukma!usenet.ins.cwru.edu!cwns1!chet From: chet@cwns1.CWRU.EDU (Chet Ramey) Newsgroups: comp.unix.shell Subject: Re: How to do mv *.xyz *.abc in shell script?? Message-ID: <1990Sep7.175536.19931@usenet.ins.cwru.edu> Date: 7 Sep 90 17:55:36 GMT References: <5569@minyos.xx.rmit.oz> <975@ria.ccs.uwo.ca> <1990Sep7.153055.6629@msi.umn.edu> Sender: news@usenet.ins.cwru.edu Reply-To: chet@po.CWRU.Edu Organization: Case Western Reserve Univ. Cleveland, Ohio, (USA) Lines: 26