| n | selects the line n |
| $ | selects the last line |
| /re/ | selects the lines matching the RE re |
| \crec | selects the lines matching the RE re. The c may be any character |
| first~step | GNU extension! Selects every step'th line starting with line first |
| addr1,addr2 | Address range: selects all input lines which match the inclusive range of lines starting from the first address and continuing to the second address |
| addr! | select those lines, where the addr does not match |
The command = prints the current line number. A substitute program for "wc -l" might be:
bash$ sed -n -e '$='
This one emulates "head":
bash$ sed -n -e '1,10p'
bash$ sed -e '10q'