具体路线

$ cat ip.txt
address
range
substitution
pattern
sample
  • ** 第 N 行

    $ sed -n '2p' ip.txt 
    range
    
    $ sed '3d' ip.txt 
    address
    range
    pattern
    sample
    
  • 最后一行

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