linux下批量修改文件内容

>NODE_1713_length_83_cov_1.000000
CCTCTACCTCTACCTCTACCTCTACCTCTACCTCTACCTCTACCTCTACCTCTACCTCTACCTCTACCTCTACCTCTACCTCT

NODE_1714_length_78_cov_80895.000000
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
NODE_1715_length_78_cov_4750.000000
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
NODE_1716_length_78_cov_351.000000
TGCATCCGGGAGGATTCGAACCTCCGACCGCTCGGTTCGTAGCCGAGTACTCTATCCAGCTGAGCTACGGATGCATTG
NODE_1717_length_78_cov_351.000000
TTGCTCTTTAACAATCCGGAACAAGCTGAAAATTTGAAACGACACAGGGTCGCATTCTTCCGTAATAAAGAATGATGA
想批量删除编号后面的length和cov
即NODE_1713_length_83_cov_1.000000变成NODE_1713

2个回答

可以使用python写一个简单的脚本。

sed -i "s/(NODE_[0-9]+).*/\1/" file

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐