a bit unrelated .. cheap numbers filter ..

gimme_num( ) { declare -n b=BASH_REMATCH\[1] ; local o m=[0-9,.] s=$n i t ;
t="(-?$m+)" ; unset -v o ; for n ; do unset -v i ; while [[ $n =~ $t ]] ;
do n=${n/"$b"} i= o+=$b$s ; done ; [[ -v i ]] && o+=$s ; done ; [[ -v o ]]
&& printf %s "$o" ; }

gimme_num ' ab3.44 cd---.99 ' cd cd 77.7.77

3.44
-.99

77.7.77

On Mon, Feb 10, 2025, 11:14 PM Phi Debian <phi.deb...@gmail.com> wrote:

> On Mon, Feb 10, 2025 at 11:10 PM Greg Wooledge <g...@wooledge.org> wrote:
>
> >
> > hobbit:~$ phi 029
> > bash: ((: 029: value too great for base (error token is "029")
> > bash: ((: 029: value too great for base (error token is "029")
> >
> > So we come full circle.
> >
>
> Nope phi() is not mine and doesn't remove the error message, see my prev
> post about nuking $((....)) syntax error
>
> 029 is not a number
>
> my latest post gives
>
> $ isanum  029  && echo y || echo n
> n
>

Reply via email to