sed 具体线路

例子

$ 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