Search code examples
htmlbashtextgrepline-numbers

Print text from specific line number of an HTML file


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.


Solution

  • One way

    $ cat foo.txt
    dog
    bird
    monkey
    
    $ sed '2!d' foo.txt
    bird
    

    In simple terms, if not line 2, delete