On Wed, 16 Jul 2003, Daniel Cordey wrote:
> On Wednesday 16 July 2003 16:56, B . Carrupt wrote:
>
> > un.deux.trois ---> un.deux
> > quatre.cinq.six ---> quatre.cinq
>
> x='un.deux.trois'
> y='quatre.cinq.six'
>
> echo ${x%%.trois}
> un.deux
>
> echo ${y%%.six}
> quatre.cinq
>
> echo ${x##un.}
> deux.trois
>
> Mais bon, c'est assez limite...
Pourquoi deux ``#'' ou ``%''?
Si:
$ x=un.deux.trois.quatre
$ y=quatre.cinq.six
Alors:
$ echo ${x%%.*}
un
$ echo ${y%%.*}
quatre
$ echo ${x%.*}
un.deux.trois
$ echo ${y%.*}
quatre.cinq
$ echo ${x%.*.*}
un.deux
$ echo ${y%.*.*}
quatre
$ echo ${x##*.}
quatre
$ echo ${y##*.}
six
$ echo ${x#*.}
deux.trois.quatre
$ echo ${y#*.}
cinq.six
$ echo ${x#*.*.}
trois.quatre
$ echo ${y#*.*.}
six
Limit�, mais sympa et efficace quand-m�me.
--
F�lix Hauri - <[EMAIL PROTECTED]> - http://www.f-hauri.ch
_______________________________________________
gull mailing list
[EMAIL PROTECTED]
http://lists.alphanet.ch/mailman/listinfo/gull