User Tools

Site Tools


sed:numbering:number_each_line_of_a_file

This is an old revision of the document!


SED - Numbering - Number each line of a file

Simple left alignment.

Using a tab instead of space will preserve margins.

sed = filename | sed 'N;s/\n/\t/'

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.1597488900.txt.gz · Last modified: 2020/08/15 10:55 by 192.168.1.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki