Thursday, October 29, 2020

Add Line Numbers to a Text File

 You want

line 1

line 2

line 3

..

to become

1. line 1

2. line 2

3. line 3

...

My way : pipe through perl -p -e 's/^/$.. /;'

nl -ba and cat -n both give a large number of spaces before the line number. Don't know how to prevent that..

No comments: