001、删除第一列
(base) root@PC1:/home/test# cat test.txt 1 MIR1302-10 1 2 FAM138A 2 3 OR4F5 3 4 RP11-34P13.7 4 5 RP11-34P13.8 5 6 AL627309.1 6 7 RP11-34P13.14 7 8 RP11-34P13.9 8 9 AP006222.2 9 10 RP4-669L17.10 10 (base) root@PC1:/home/test# sed 's/^\S\+[\t ]//' test.txt ## sed命令删除第一列 MIR1302-10 1 FAM138A 2 OR4F5 3 RP11-34P13.7 4 RP11-34P13.8 5 AL627309.1 6 RP11-34P13.14 7 RP11-34P13.9 8 AP006222.2 9 RP4-669L17.10 10
002、删除最后一列
(base) root@PC1:/home/test# cat test.txt 1 MIR1302-10 1 2 FAM138A 2 3 OR4F5 3 4 RP11-34P13.7 4 5 RP11-34P13.8 5 6 AL627309.1 6 7 RP11-34P13.14 7 8 RP11-34P13.9 8 9 AP006222.2 9 10 RP4-669L17.10 10 (base) root@PC1:/home/test# sed 's/[\t ]\+\S\+$//' test.txt ## sed命令删除最后一列 1 MIR1302-10 2 FAM138A 3 OR4F5 4 RP11-34P13.7 5 RP11-34P13.8 6 AL627309.1 7 RP11-34P13.14 8 RP11-34P13.9 9 AP006222.2 10 RP4-669L17.10
标签:10,AL627309.1,34P13.9,test,sed,linux,第一列,RP11 From: https://www.cnblogs.com/liujiaxin2018/p/16611401.html