csh filename substitution

lawesn at SouthBank.UUCP lawesn at SouthBank.UUCP
Sat Mar 7 03:22:05 AEST 1987


Apologies if this question has popped up in the past but...

I was trying to rename a group of files from 'st.*' to '*'

e.g.
	st.fred.dat	=>	fred.dat
	st.jim.c	=>	jim.c
	st.nick		=>	nick

I noticed that there was (according to the csh manual) an operator :s/l/r/
which was supposed to substitute 'r' for 'l' within the filename.

So, I tried (amongst other things):

	foreach i (st.*)
	mv $i $i:s/st.//
	end

This replies with a message 'Variable syntax'

Could some kind soul out there please point out to me what I am doing wrong.
I could achieve the correct result with sed, but would like to use this
apparently nice feature (bug :-) in csh.

Thanks.

-- Nick Lawes
-- 
+--------------------------------------------------------------------------+
|  Nick Lawes (South Bank Polytechnic, UK) | ..mcvax!ukc!hrc63!kbsc!lawesn |
+------------------------------------------+-------------------------------+



More information about the Comp.unix.questions mailing list