Thread: grep & regexp
View Single Post

   
  #7 (permalink)  
Old 02-15-2008, 10:44 AM
Roberto Zini
 
Posts: n/a
Default Re: grep & regexp

Bill Campbell wrote:
> On Fri, Oct 03, 2003, Roberto Zini wrote:
>


[snip]

>
> For numeric manipulations you may want to use the ``bc'' program, setting
> the scale appropriately, or perhaps perl (the double quotes below around
> the perl -e argument expand $variable from your shell, and the qq() is
> perlish for double quotes that makes it easier to do things like this from
> the shell).
>
> value=`perl -e "printf (qq(%f.2d), $variable);"`
> ^ ^


>



Bill,

thanks for your help.

Here's the correct syntax for the above command:

value=`perl -e "printf (qq(%.2f), $variable);"`

Please notice I removed the "f" after the "%" char and the trailing "d"
after the "2".

Thanks,
Roberto
--
Roberto Zini - Technical Support Manager - email:r.zini<AT>strhold.it
Technical Support Manager -- Strhold Evolution Division R.E. (ITALY)
---------------------------------------------------------------------
"Has anybody around here seen an aircraft carrier?"
(Pete "Maverick" Mitchell - Top Gun)

Reply With Quote