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.
我正在尝试找到一种从 HTML 文件的特定行号打印文本的方法。
我找到了打印文本搜索行号的方法,但我想做相反的事情,打印行号的文本,其中行号保持不变,但那里的文本可能会改变。
单程
$ cat foo.txt dog bird monkey $ sed '2!d' foo.txt bird
简单来说,if not line 2, delete
if not line 2, delete