On Wed, Jun 18, 2003 at 06:08:28AM +0100, Anders Karlsson wrote: : On Wed, 2003-06-18 at 04:37, Jerry A! wrote: : > For sh/ksh88 do the following: : > : > for i in `ls -d *SNG*`; do : > mv $i `echo $i | sed 's/\.SNG//g' : > done : : While this example might be easy to follow, it on two occasions invoke : external binaries, 'ls' and 'sed', which in turn invoke another copy of : the shell. It is ineffective. The snippet I suggested last night does : not. You're absolutely right. Sorry I was being lazy in answering the question in regards to making this work with sh and ksh. While the 'ls' in unnecessary, the 'sed' is still needed for Bourne shell since it doesn't support %/%%/#/## parameter expansion. Regardless, I'll make sure I'm not so sloppy in the future. : > : Yeah, ksh can do '%%' like someone else suggested. : > : > ksh93 also supports sed-like substitions. : : This was a feature I was unaware of. Now that I know it is there, I'll : be making good use of it. :) It's had it since ksh93 was introduced in well 1993. I believe that this predates bash's support of this feature (but I'm not certain). --Jerry -- Open-Source software isn't a matter of life or death... ...It's much more important than that!