*BSD News Article 42662


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msunews!agate!howland.reston.ans.net!swrinde!hookup!solaris.cc.vt.edu!csugrad.cs.vt.edu!csugrad.cs.vt.edu!not-for-mail
From: jaitken@csugrad.cs.vt.edu (Jeff Aitken)
Newsgroups: comp.unix.bsd
Subject: Re: Newbie Question: mv *.t *.txt ????
Date: 19 Feb 1995 13:52:32 -0500
Organization: Virginia Tech Computer Science Dept, Blacksburg, VA
Lines: 17
Message-ID: <3i841g$48b@csugrad.cs.vt.edu>
References: <D41nyo.Mon@ritz.mordor.com> <3huiti$4lr@dagny.galt.com>
Reply-To: jaitken@vt.edu
NNTP-Posting-Host: csugrad.cs.vt.edu
X-Newsreader: TIN [version 1.2 PL2]

: Hany Nagib (hany@ritz.mordor.com) wrote:
: : I know this must be a very simple question, but it's not in the FAQ.
: : "mv" looks like it works exactly like "rename" in DOS, except when using 
: : wild card. For example if I wanted to rename all my .t files to .txt, I 
: : expect "mv *.t *.txt" to work .. but it doesn't. Why ? And how do I 
: : accomplish this in BSD unix ?

This works in {t}csh:

foreach file ( *.t )
foreach? mv $file `basename $file .t`.txt
foreach? end

-- 
Jeff Aitken
jaitken@vt.edu