On 1/17/2007, Alberto Cristancho said:

I'm a definite newbie to grep, so any help would be very much appreciated...

Grep doesn't do math by itself, you'll need to use a scripting language.

Here's a perl script that seems to do the trick...

#!/usr/bin/perl

use strict;

my $text;
{
    local $/;
    $text = <>;
}

$text =~ s{
    (<num>)
    \s*
    (\d+)
    \s*
    (</num>)
}
{
    $1 . ( $2 + 2 ) . $3;
}egmx;

print $text;

0;

(Warning: tested only very briefly.)

Seth


--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to