Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何用 sed 替换任何不是“A”、“C”、“G”、“T”、“N”的字符串?
例如我有以下数据:
>AFCCCCC 1 cagktgagtgataaggc >AFCGH22 1 cagntgagtgstaaggc
我想删除不以'>'开头的不是[ACGTN]的每个字符
因此我希望得到这个输出:
>AFCCCCC 1 cagtgagtgataaggc >AFCGH22 1 cagntgagtgtaaggc
请注意,我删除了第一个和第二个序列的“k”和“s”。
试试这个:
sed '/^>/!s/[^ACGTN]//ig' input.txt
There are slightly less than a billion similar questions on SO, with about the same number of reasons for the error. I just don't seem to find mine.
Kwicks accordian and the jQuer