I have a file that has tab separated data. I need to delete 2 columns. So, what command(s) can I use to delete everything from the current tab to the next tab?
To delete columns 4 and 5:
:%s/^\(.\{-}\t\)\{3}\zs.\{-}\t.\{-}\t//
Explanation:
^ => start of line
.\{−} => as few characters as possible
\( .\{-}\t \)\{3} => three times as few characters as possible followed with a tab
\zs => start of match
It could be clearer with the \v switch:
:%s/\v^(.{-}\t){3}\zs.{-}\t.{-}\t//
I think shift+ctrl+v is what you are looking for.
http://jvi.sourceforge.net/javahelpset/jvi-vis_block.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With