How to extract sub-string on bash-shell

Hi everyone! First of all, I'm sorry for asking about bash-script.

I want to extract "3.4.4". I tried as follows.

/*Prompt*/ $arm-linux-gcc --version arm-linux-gcc (GCC) 3.4.4 Copyright (C) 2004 Free Software Foundation, Inc.

/*Shell Script*/ CROSS_GCC=arm-linux-gcc version=`$CROSS_GCC --version`

tmp=`expr "$version" : '\(.*(GCC) [0-9].[0-9].[0-9]\)'` tmp2=`expr "$version" : '\((GCC) [0-9].[0-9].[0-9]\)'`

echo $tmp echo $tmp2

/*Result of Shell Script*/ arm-linux-gcc (GCC) 3.4.4

Reply to
demiahn
Loading thread data ...

On Wed, 25 Mar 2009 15:23:50 +0900, demiahn rearranged some electrons to say:

man awk

Reply to
david

We'll assume you're also sorry about multi-posting instead of cross-posting. I already answered your question in another group.

--
Grant Edwards                   grante             Yow! Jesus is my POSTMASTER
                                  at               GENERAL ...
                               visi.com
Reply to
Grant Edwards

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.