Number line of a file (simple left alignment)

$ sed = file.txt | sed 'N;s/\n/\t/'

Number line of a file (number on left, right-aligned)

$ sed = file.txt | sed 'N; s/^/ /; s/ \*\(.\{6,\}\)\n/\1 /'

Number line of file, but only print numbers if line is not blank

$ sed '/./=' file.txt | sed '/./N; s/\n/ /'

Count lines (emulates "wc -l")

$ sed -n '$='
Comments