User Tools

Site Tools


sed:numbering:number_each_line_of_a_file_number_on_left_right-aligned

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
sed/numbering/number_each_line_of_a_file_number_on_left_right-aligned.txt · Last modified: 2020/08/15 10:58 by 192.168.1.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki