[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Portability issue

From: DervishD
Subject: Re: Portability issue
Date: Sun, 8 Aug 2004 10:11:59 +0200
User-agent: Mutt/

    Hi Paul :)

 * Paul Eggert <address@hidden> dixit:
> > I would like to know (if you have such information, of course) which
> > 'expr's out there support 'substr' expressions in addition to the
> > GNU coreutils one, of course.
> Sorry, haven't a clue.

    Well, thanks anyway :)

> But you shouldn't need substr: you can always
> get the equivalent by using pattern matching.  E.g., instead of this:
> expr substr "X$string" 3 5
> you use this:
> expr "X$string" : 'X.\(.....\)'

    I thought about using that, but the problem is that I have the
index in a shell parameter. Currently I do:

    expr substr "x$string" $tmpindex 1

    If I need to translate this in a pattern matching expression, I
must calculate the number of 'dots', because I'm not sure if the
'{N}' syntax (to match exactly '{N}' times) is portable enough. I
must assume it is, because that syntax is part of a BRE as specified
by SUSv3 (I don't have access to a POSIX standard so I've chosen SUS
as my standard base).

    Thanks a lot for your help, Paul :)

    Raúl Núñez de Arenas Coronado

Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]