I'm using this command below to remove the first column of a document:
%s/^[^\t]*\zs\t[^\t]*\ze//g
开发者_StackOverflow
but it says command not found. Any idea?
Here's the quickest way to remove the first column:
- Press gg to go to the first character in the document.
- Hit Ctrl+V to enter visual block mode.
- Hit G (that is, shift-g) to go to the end of the document
- Hit x to delete the first column.
I like the block selection solution of @Peter, but if you want to use substitution you need this command:
:%s/^.//
Let's analyze why this works:
:%s
exec a substitution on all the document/^./
select the first character after the start of the line/
and replace it with... nothing.
If I understand you correctly, this should do the job:
:%s/^[^\t]//
The command removes all leading characters that are not a tabulator.
Alternatively, if you're editing a tabulator separated values document and want to remove all "columns" before the first tabulator, then this should do it for you:
%s/^[^\t]*\t//
The below command worked for me:
:%s/^\w*//
精彩评论