Linux中删除第一列中指定分隔符最后的一个字段

 

001、

[root@localhost test]# ls
a.txt
[root@localhost test]# cat a.txt           ## 测试数据
00_3    8834
1b_kk   ffaa
55_f3_34        8834
aa_bb_kk_44     44aa
[root@localhost test]# sed 's/\([^ ]*\)_[^ ]\+\t\(.*\)/\1\t\2/' a.txt     ## 删除第一列的最后一个字段
00      8834
1b      ffaa
55_f3   8834
aa_bb_kk        44aa

 

。 

 

posted @ 2025-03-15 01:05  小鲨鱼2018  阅读(24)  评论(0)    收藏  举报