Вопрос

I'm trying to find a way to print the text from a specific line number of an HTML file.

I've found ways to print the line numbers of a text search, but I want to do the reverse, printing the text of the line number, where the line number stays constant but the text there may change.

Это было полезно?

Решение

One way

$ cat foo.txt
dog
bird
monkey

$ sed '2!d' foo.txt
bird

In simple terms, if not line 2, delete

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top