0

I have a table with 100,000 rows. The format is like this:

abc '\t' gi| a b c  d e

column abc is separated by tab while other columns are separated by space.I want to remove the column 'gi|' and keep all other columns. I tried use tab or | as my delimiter but it didn't work well. Any thoughts?

4

2 回答 2

0

你可以使用awk的sub功能。

awk '{sub(/.*/,"",$2)}1' file

或者

只需为第 2 列变量分配一个空值。

awk '{$2=""}1' file
于 2015-02-12T18:10:31.927 回答
0

为什么不简单地忽略这些字段?

sed 's/\t[^\t ]* /\t/' file

将删除第一个制表符后的文本到空格。

于 2015-02-12T18:17:33.070 回答