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

Re: swapping three columns in a file..

Expand Messages
  • Charles E Campbell Jr
    ... There s visswap, which you can get from http://mysite.verizon.net/astronaut/vim/index.html#VISSWAP (and as mentioned in
    Message 1 of 3 , Dec 19, 2006
      sasikumar.kandhasamy@... wrote:

      > How to swap the three columns in file without using substitute
      >command?
      >
      >Let us say file with the following contents,
      >
      >A1 B1 C1
      >
      >A2 B2 C2
      >
      > Then after swapping the file content should be,
      >
      >C1 A1 B1
      >
      >C2 A2 B2
      >
      >
      There's visswap, which you can get from

      http://mysite.verizon.net/astronaut/vim/index.html#VISSWAP

      (and as mentioned in http://vim.sourceforge.net/tips/tip.php?tip_id=329)

      With it, you can

      a) visually select a column using visual blocks (ctrl-v and move cursor)
      b) press ctrl-y (sort of a yank)
      c) visually select another column using visual blocks
      c) press ctrl-x (exchange)

      Works with V and v (visually selected lines, visually selected
      characters), too.

      So:

      1) swap columns A & C
      2) swap columns B & A

      Regards,
      Chip Campbell
    Your message has been successfully submitted and would be delivered to recipients shortly.