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.
嗨,我有以下文件:
>AKJDHDLFNLDNFLNFRFMD >ALKSJLDKJSAD >GLHGFNHHOTHJRTKHRNLGKNFKGNHGKHMNFGH
我想用'>'符号分割这个文件以获得:
> AKJDHDLFNLDNFLNFRFMD > ALKSJLDKJSAD > GLHGFNHHOTHJRTKHRNLGKNFKGNHGKHMNFGH
也许在 perl/awk 中有一些东西?非常感谢。
perl -0ne 'print join "\n", grep length, split /\n?(>)/' file
一种方法是简单地替换>为>\n,例如
>
>\n
perl -np 's/>/>\n/' file