标签:awk
问题:
有一个文件file:(tab分隔)
1 12123 A G BB234T Keep Rejj
1 22123 T B CB34N Keep Rejj
2 12243 A C CB4423T Keeeep Rejjj
2 22343 G C HB4T Kep Rjj
3 1113 C G BB2334T Kp Rj
想要删除第5列的最后一个字符:
1 12123 A G BB234 Keep Rejj
1 22123 T B CB34 Keep Rejj
2 12243 A C CB4423 Keeeep Rejjj
2 22343 G C HB4 Kep Rjj
3 1113 C G BB2334 Kp Rj
解答:
awk ‘BEGIN{OFS="\t"}{sub(/.$/,"",$5)}1‘ file
1 12123 A G BB234 Keep Rejj
1 22123 T B CB34 Keep Rejj
2 12243 A C CB4423 Keeeep Rejjj
2 22343 G C HB4 Kep Rjj
3 1113 C G BB2334 Kp Rj
本文出自 “八英里” 博客,请务必保留此出处http://5921271.blog.51cto.com/5911271/1768484
标签:awk
原文地址:http://5921271.blog.51cto.com/5911271/1768484