Pergunta

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.

Foi útil?

Solução

One way

$ cat foo.txt
dog
bird
monkey

$ sed '2!d' foo.txt
bird

In simple terms, if not line 2, delete

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top