Loading ...
Sorry, an error occurred while loading the content.

Re: mathematical operations on columns of numbers

Expand Messages
  • Edward Peschko
    ... hmm. that s sort of clunky. as opposed to: ctrl-v (select text to operate on, save in buffer a) ... (get same results) IMO the above syntax is much easier
    Message 1 of 22 , May 28 4:45 PM
    • 0 Attachment
      > aaaaaaa 12 ___
      > aaaaaaa 34 ___
      > aaaaaaa 56 ___
      > aaaaaaa 78 ___
      > ==========================
      > The start column is 10, and the width is 2. so
      > :%s/\%>9c.\{2}/\=( substitute(submatch(0)*13, '\d$', '.&', '') )

      hmm. that's sort of clunky. as opposed to:

      ctrl-v
      (select text to operate on, save in buffer a)
      :opa * 1.3 (or any arbitrary mathematical operation)

      (get same results)

      IMO the above syntax is much easier to use. Magnitudes in fact. I don't know off-hand
      if buffers are integrated into the perl options, but that would be cool too - ie:

      :perl a '$_ * 1.3'

      operating on strings in buffer a would be neat too.

      Ed
    Your message has been successfully submitted and would be delivered to recipients shortly.