[dywang@dywmac ~]$ cat -n /etc/passwd | head | sed '2,5d' 1 root:x:0:0:root:/root:/bin/bash 6 sync:x:5:0:sync:/sbin:/bin/sync 7 shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown 8 halt:x:7:0:halt:/sbin:/sbin/halt 9 mail:x:8:12:mail:/var/spool/mail:/sbin/nologin 10 uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
[dywang@dywmac ~]$ cat -n /etc/passwd | head -5 | sed '3d' 1 root:x:0:0:root:/root:/bin/bash 2 bin:x:1:1:bin:/bin:/sbin/nologin 4 adm:x:3:4:adm:/var/adm:/sbin/nologin 5 lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
[dywang@dywmac ~]$ cat -n /etc/passwd | tail | sed '5,$d' 43 hsqldb:x:96:96::/var/lib/hsqldb:/sbin/nologin 44 openvpn:x:495:491:OpenVPN:/etc/openvpn:/sbin/nologin 45 toranon:x:494:490:Tor anonymizing user:/var/lib/tor:/sbin/nologin 46 mockbuild:x:502:502::/home/mockbuild:/sbin/nologin
"\"
跳脫 Enter 進行新行的增加。
[dywang@dywmac ~]$ cat -n /etc/passwd | head -5 | sed '2a Drink tea or .....\ > drink beer?' 1 root:x:0:0:root:/root:/bin/bash 2 bin:x:1:1:bin:/bin:/sbin/nologin Drink tea or ..... drink beer? 3 daemon:x:2:2:daemon:/sbin:/sbin/nologin 4 adm:x:3:4:adm:/var/adm:/sbin/nologin 5 lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
[dywang@dywmac ~]$ cat -n /etc/passwd | head -6 | sed '2,5c No 2-5 rows' 1 root:x:0:0:root:/root:/bin/bash No 2-5 rows 6 sync:x:5:0:sync:/sbin:/bin/sync
[dywang@dywmac ~]$ cat -n /etc/passwd | sed -n '4,6p' 4 adm:x:3:4:adm:/var/adm:/sbin/nologin 5 lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin 6 sync:x:5:0:sync:/sbin:/bin/sync