Need a file renaming facility

Root Boy Jim rbj at icst-cmr.arpa
Wed May 4 06:07:14 AEST 1988


   From: Gary Benson <inc at tc.fluke.COM>

   Hello,

Good morning, Mister Benson, I see you're doing well...

   Now I want to rename all those ".pre" files to the same name without ".pre".

As usual, Doug Gwyn posted the quickest, most succinct, and most universal
solution (I do say something nice about him every once in awhile :-). Some
of the other solutions that were posted were incredibly unwieldy, and their
posters should rethink their approach to the problem. Repent heathens!

However, for those of us with the csh, there is yet another solution:

	foreach x (*.pre)
		mv $x $x:r
	end

This may be typed directly into the shell, but only works with suffixes
delimited with dots. Multiple dots work, so `set x=a.b.c; echo $x:r'
yields `a.b'. You may add the -f or -i flags directly to mv if desired.

   Gary Benson		   -_-_-_-_-_-_-_-_-inc at tc.fluke.com_-_-_-_-_-_-_-_
   Publication Services	   Ensign Benson, Space Cadet, Digital Circus, Sector R
   John Fluke Mfg. Co. Inc.   _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-

	(Root Boy) Jim Cottrell	<rbj at icst-cmr.arpa>
	National Bureau of Standards
	Flamer's Hotline: (301) 975-5688
	The opinions expressed are solely my own
	and do not reflect NBS policy or agreement
	Sign my PETITION.



More information about the Comp.unix.questions mailing list