Hi. My name is Marcelo I'm new in this list and in VIM.

Welcome!

My question is about one "input" to many lines and
columns in just one render (evaluation, returns ...) For
example, if i have a table of numbers and need add 10 for
 the forth columns in the 420, 530 and 710 lines. Could
you point any script, code, theme to read,...

I'm not sure I fully understand what you're getting at here, but I'll give a try (your English is a heckuva lot better than my Portugese).

It sounds like you want to add "10" to either

-numbers on each row of a file, where those numbers are found at columns 420, 530, and 710

or

-numbers found in column 4 of a table, but only make the changes on certain line numbers

I *think* you mean the second rather than the first interpretation. You also don't specify whether they're character-columns (in which case, adding 10 could bump the number up to an additional column), if they're positional columns (such as "column #4 starts at character 21 in the line"), or delimited columns (such as with a CSV file).

My first thought would be (totally untested)

:g/./if '420,430,710'=~'\<'.line(".").'\>'| [action] |endif

where [action] is

s/\%4c\d\+/=submatch(0)+10/e

This *should* do [action] on each of the lines in the comma-separated list. An ugly hack, but it looks like it should work.

As for the [action], this is where it would need clarification regarding what defines a column.

Some sample data of the rows in question might help sort out that matter.

Hope this helps. If you have further questions, feel free to ask.

-tim







Reply via email to