On Mon, Feb 07, 2011 at 10:23:19AM EST, rameo wrote:
> Let say I have these dates:
>
> Variable 1 - 21.185 Variable a - 22.345
> Variable 2 - 1.401.218 Variable b - 1.821
> Variable 3 - apples Variable c - 17.643
> Variable 4 - water Variable d - 56.030
> Variable 5 - 656.647 Variable e - 65.123
> Variable 6 - 92.200 Variable f - 2.000
>
> I would like to select the 2nd column (21.185 to 92.200) and right
> align all the info in the block
>
> I use this to left align the data in a block:
> :<C-U>'<,'>s/\%V\(\s*\)\(.\{-}\)\%(\%V\@!\\|$\)/\2\1/
>
> How do I right align the data in a block?
> I tried to switch the space block with the text block in the code but
> something doesn't work.
’Some people, when confronted with a problem, think ’’I know, I'll
use regular expressions.’’ Now they have two problems.’ -- JMZ
Unless you absolutely insist on getting cross-eyed and ‘Mastering
Regular Expressions’... like the book sez, you could also try the awk
approach:
| awk '{printf "%-10s %s %s %10s %-10s\n",$1,$2,$3,$4,$5}' .. etc.
Untested, but some variation or other, possibly used as a Vim ‘!!’
filter should get you there quicker.. while remaining _legible_.
;-)
Not what you asked, but since nobody stepped up to the plate..
cj
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php