Question

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.

Was it helpful?

Solution

One way

$ cat foo.txt
dog
bird
monkey

$ sed '2!d' foo.txt
bird

In simple terms, if not line 2, delete

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top