Subject: Re: changing a group of file name extensions
To: None <buhrow@cats.ucsc.edu>
From: Robert Alexander Baxter <rbaxte03@harris.com>
List: netbsd-help
Date: 05/21/1999 15:36:16
You don't need to use sed---csh will find the extension for you:
foreach i (*.CPP)
mv $i $i:r.C
end
The :r modifier chops off the extension. These "modifiers" like :r, :r,
and :t are something I like about csh.
-Alex (:-)
rbaxte03@harris.com
>
> Resent-Message-Id: <199905211915.PAA08240@suc1a.harris.com>
> Resent-Date: Fri, 21 May 1999 18:59:39 GMT
> Resent-From: alex@santa.asf.alaska.edu
> Resent-To: rbaxte03@harris.com
> From: buhrow@cats.ucsc.edu (Brian Buhrow)
> Date: Fri, 21 May 1999 12:14:51 +0000
> To: Guy Santiglia <fredfl2@soback.kornet.net>, netbsd-help@netbsd.org
> Subject: Re: changing a group of file name extensions
> Delivered-To: netbsd-help@netbsd.org
>
> I would:
> from the csh prompt, do:
> foreach name (`ls *.cpp`)
> ?set destname = `echo $name |sed 's+\.cpp+.c+`
> ?mv $name $destname
> ?end
> On May 21, 11:40am, Guy Santiglia wrote:
> } Subject: changing a group of file name extensions
> }
> }
> }
> }
> } Let's say you had a big group of files with the extension *.CPP like this
> }
> } EX02010.CPP EX06006.CPP EX07019.CPP EX08008.CPP EX10001.CPP EX10021.CPP
> }
> } (only much bigger)
> }
> }
> } and you want them all to have the extension *.C and not *.CPP.
> } And let's say that you are lazy and don't want to type:
> }
> } # mv EX02010.CPP EX02010.C
> }
> } hundreds of times :(
> }
> } What would you do? What WOULD you do?
> }
> } Or what list might you ask a question like this?
> }
> } EX02010.CPP EX06006.CPP EX07019.CPP EX08008.CPP EX10001.CPP EX10021.CPP
> }
> } Thanks for any suggestions,
> }
> } Guy
> } ____________________________________________________________
> } Guy Santiglia Quadra 610, NetBSD 1.3.3!
> } South Korea
> } ____________________________________________________________
> }
> >-- End of excerpt from Guy Santiglia
>