sed Address and address range Specific line


Example

$ cat ip.txt
address
range
substitution
pattern
sample
  • Nth line

    $ sed -n '2p' ip.txt 
    range
    
    $ sed '3d' ip.txt 
    address
    range
    pattern
    sample
    
  • Last line

    $ sed -n '$p' ip.txt 
    sample