Reginald Beardsley ha scritto:
> Alessandro Selli wrote:
>> T wrote:
>>> Hi:
>>> I was trying to find negative numbers in a file. I found that the
>>> following didn't work:
>>> egrep -e '-[:digit:].[:digit:]' top.sta.rpt
>> There are square brackets missing:
>> muser@drone ~ $ cat top.sta.rpt
>> 234
>> 86
>> -2
>> 57
>> -651
>> 9743
>> 832
>> -68732
>> -7873
>> muser@drone ~ $ egrep -e '-[[:digit:]].[[:digit:]]' top.sta.rpt
>> -651
>> -68732
>> -7873
>> Note you'd still miss the -2 negative number, but this might be the
>> desired behaviour.
>> Bye,
> Curious. What egrep are you using? On Solaris 10 U6 x86, /bin/egrep
> produced no output w/ your example, but "egrep -e '-[0-9]' " produced
> the desired output.
Sorry, I forgot about this matter.
-bash-3.00$ uname -a
SunOS lustro 5.10 Generic_141414-01 sun4u sparc SUNW,Sun-Blade-1000
-bash-3.00$ cat /etc/release
Solaris 10 5/09 s10s_u7wos_08 SPARC
Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 30 March 2009
-bash-3.00$ which egrep
/usr/xpg4/bin/egrep
/usr/bin/egrep doesn't do the job:
-bash-3.00$ /usr/bin/egrep -e '-[[:digit:]].[[:digit:]]' top.sta.rpt
-bash-3.00$/usr/bin/egrep -e '-[:digit:].[:digit:]' top.sta.rpt
-bash-3.00$
Bye,
--
Alessandro Selli http://alessandro.route-add.net
AVVERTENZA: i messaggi inviati a "trappola" non mi arriveranno.
WARNING: messages sent to "trappola" will never reach me.
Chiave PGP/GPG key: EC885A8B