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

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

Example

Running that command again this file:

testfile
aaa
bbb
ccc

returns:

testfile
     1  aaa
     2  bbb
     3  ccc