Subject: Re: renaming a group of files
To: Sam Carleton <sam@linux-info.net>
From: Herb Peyerl <hpeyerl@beer.org>
List: netbsd-help
Date: 12/26/2002 20:50:38
Sam Carleton <sam@linux-info.net> wrote:
> file1.txt -> TheTestFile1.txt
> file2.txt -> TheTestFile2.txt
> file3.txt -> TheTestFile3.txt
>
> I keep running into this type of thing. I have a feeling that
> there is a simple way to do it with a bit of shell
> programming, but I am clueless. Does anyone have any
> thoughts?
I'm sure there's a better way, but I'm never in the mood to look
for it, so I usually do:
foreach I (file?.txt)
mv $I `echo $I | sed -e 's/file/TheTestFile/'`
end
at the command line, and then just get on with my life.
Undoubtedly you will find as many different ways to do that as there
are atoms in the universe.