On Fri, Jan 15, 2010 at 5:01 AM, Gianluca Cecchi <gianluca.cec...@gmail.com>wrote:
> On Thu, Jan 14, 2010 at 11:10 AM, Gianluca Cecchi > <gianluca.cec...@gmail.com> wrote: > > Todo: > > 1.20 must become 1.2 > > 1.00 must become 1 > > 1.25 must remain the same > > Thanks to Dave, Jake and Geoffrey even if my answer was OT... thanks > also for the perl links > > For Jake: > the problem is that in your example I think that perl assumes they are > numbers and renders them correspondingly. In my case, I get them as > strings during the workflow, so that perl doesn't manage > automatically... > For example: > perl -le '$foo=1.00; print $foo' > 1 > [gcec...@tekkaman ~]$ perl -le '$foo="1.00"; print $foo' > 1.00 > > BTW, it was the correct regex that I missed. Simple to read after you > pointed out, but (at least for me) difficult to catch initially... ;-) > Actually I had to make the job in awk where I then easily got the same > effect with: > sub(/\.?0+$/, "", foo) > Ah, right. Well, just for the sake of TMTOWTDI, how about: C:\>perl -le "$_ = q[GNU tar 1.20 is available]; print" GNU tar 1.20 is available C:\>perl -le "$_ = q[GNU tar 1.20 is available]; s/([.\d]+)/$1+0/eg; print" GNU tar 1.2 is available -- -jp I wish I would have a real tragic love affair and get so bummed out that I'd just quit my job and become a bum for a few years, because I was thinking about doing that anyway. deepthoughtsbyjackhandey.com
-- users mailing list users@lists.fedoraproject.org To unsubscribe: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines