Delete a character in a specified column

Source: Internet
Author: User

Problem:

There is a file: (Tab Delimited)
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

To delete the last character of the 5th column:
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


Answer:

awk ' begin{ofs= ' \ t '}{sub (/.$/, "", $ $)}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

This article is from the "Eight Miles" blog, so be sure to keep this source http://5921271.blog.51cto.com/5911271/1768484

Delete a character in a specified column

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.