我最近开始使用 linux 并且我几乎完全忘记了 sed 命令。我需要编辑一个包含一堆以公共字符“>”开头的长行的文件,并删除该行的其余部分,只保留第一个单词,但不要使用 sed 命令触及任何不以“>”开头的行。
换句话说,我需要转这个(为了演示目的,只是第一个条目的一部分):
>YAL001C TFC3 SGDID:S000000001, Chr I from 151006-147594,151166-151097, Genome Release 64-1-1, reverse complement, Verified ORF, "Largest of six subunits of the RNA polymerase III transcription initiation factor complex (TFIIIC); part of the TauB domain of TFIIIC that binds DNA at the BoxB promoter sites of tRNA and similar genes; cooperates with Tfc6p in DNA binding"
MVLTIYPDELVQIVSDKIASNKGKITLNQLWDISGKYFDLSDKKVKQFVLSCVILKKDIE
VYCDGAIP*
Run Code Online (Sandbox Code Playgroud)
进入这个:
>YAL001C
MVLTIYPDELVQIVSDKIASNKGKITLNQLWDISGKYFDLSDKKVKQFVLSCVILKKDIE
VYCDGAIP*
Run Code Online (Sandbox Code Playgroud) sed ×1