Adrian Johnson wrote:
%s/^[^\t]*\zs\t[^\t]*\ze//g

that removed the first column! How can I remove 2nd column.

Are you sure you transcribed it properly into vim, or that there wasn't an extra leading (possibly empty) column? I just issued the above and it worked fine for removing the 2nd column of a tab-delim file.

The above searches for

 ^       the beginning of the line
 [^\t]*  anything that isn't a tab
 \zs     starts the replacement here
 \t      a tab (delimiting col#1 and col#2)
 [^\t]*  anything that isn't a tab (col#2)
 \ze     superfluous in this case, but harmless

and replaces the match (the 2nd column) with nothing. The "g" flag is also superfluous since there should only be one match in the line.

You might also have some variance in your 'magic' setting which would be helpful to know:

  :set magic?

though it's not commonly changed (since the help says something like "don't change this unless you want lots of stuff to break")

-tim




--
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

Reply via email to