> I have several files where I need to make some substitutions. In one of

this

> substitutions I need to make a calculation on a result from a search.

> For example, I have a column like this:

>

> 00:30

> 01:00

> 01:30

> 02:00

> ...

>

> I want to change only the lines that end with 00; on this lines I need to

subtract

> 1 from the number on left side of :. So, the result should be:

How does this work for you?

%s/\(\d\d\):00/\=substitute('0'.(substitute(submatch(1),

'^0*','','g')-1), '.*\(..\)', '\1', '').':00'

It's ugly, but it accomodates the wrinkle that vim considers leading zeros

an indicator of an octal number, which does funky stuff with the maths at

hand. So, it strips off the leading zero, decrements, tacks a leading zero

back onto it, and then pulls the two right-most characters. It doesn't

monkey with "00:00" any differently (you get a negative number--which may or

may not be the desired behavior)

Hope this helps,

-tim