Something like this could work for any case: sed -e
's/valgrind-\([0-9]\)\.\([0-9]\).*/\1 - \2/g'

$ echo valgrind-3.6.0.SVN-Debian | sed -e
's/valgrind-\([0-9]\)\.\([0-9]\).*/\1 - \2/g'
3 - 6
$ echo valgrind-3.6.0 | sed -e 's/valgrind-\([0-9]\)\.\([0-9]\).*/\1 - \2/g'
3 - 6
$ echo valgrind-3.6.0whateveryouwant | sed -e
's/valgrind-\([0-9]\)\.\([0-9]\).*/\1 - \2/g'
3 - 6

Andrés Roldán


On Wed, Sep 15, 2010 at 7:10 PM, Nicholas Nethercote <[email protected]
> wrote:

> On Wed, Aug 25, 2010 at 5:34 PM, Oliver Schneider <[email protected]>
> wrote:
> >
> > maybe someone can tell me whether my little shell snippet is based on
> > the right assumptions in order to find the Valgrind version:
> >
> > valgrind --version|sed 's/valgrind-//g;s/\([0-9]*\.[0-9]\)\..*/\1/'
> >
> > Can one rely on the format of the string being
> > "valgrind-x.y.z[whatever]" (where x.y are the major and minor version
> > number)?
> >
> > The default seems to be "valgrind-x.y.z" but on Ubuntu I've seen
> > "valgrind-3.6.0.SVN-Debian" and I'm only after major and minor version
> > number as I presume that similar incompatibilities would not get
> > introduced with patch releases (where z varies).
>
> For released versions we use valgrind-x.y.z but who knows what Debian
> and other packagers might do.
>
> Nick
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Valgrind-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
>
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to