Deleting first column with vim
This should delete all chars before and including the 1st tab on any line:
:%s/^[^\t]*\t//
Command line cut
:
cut -f 2- {filename.txt} > {filenamenew.txt}
cut defaults to tabs; if you want something else like a space add -d " "
.
-f
is fields to copy over. 2- means all from (and including) column 2.
Through awk
,
awk -F"\t" '{print FS,$2}' file > newfile
It cuts the first column and prints only the remaining tab and second column.
Through sed
,
sed -r 's/^([^\t]*)\t(.*)$/\t\2/g' file > newfile
:%s/[^\t]*\t//
On every line (%
), replace (s/ORIGINAL/REPLACEMENT/
) the first occurrence of “non-tab characters ([^\t]
, in any number (*
)) followed by a tab \t
” by nothing. You can type Tab instead of \t
.
Alternatively you can match the shortest sequence of characters (.\{-}
) ending in a tab. .*\t
would match the longest match for .*
, so it would match all but the last column; .\{-}
matches the shortest match which is the first column.
:%s/.\{-}\t//