Ubuntu – How to delete second column in Vim

vim

I have a tab-delimited file like:

name1   verb1   name2   verb2   etc...

I want to delete the second column. I tried editing one of these answers, but being not familiar with sed and awk, I couldn't.

Can anyone help me?

Best Answer

In vim, you should be able to use the command

:%s/\t[^\t]*//

(substitute TAB followed by zero or more occurrences of any character except TAB with nothing). If your file has only two columns you could use a slightly simpler :%s/\t.* or :%s/\t.*$which replace the first TAB and any following characters up to the end of the line.

Related Question