Hard-to-find tips on otherwise easy-to-do tasks involving everyday technology, with some advanced insight on history and culture thrown in. Brought to you by a master dabbler. T-S T-S's mission is to boost your competitiveness with every visit. This blog is committed to the elimination of the rat from the tree of evolution and the crust of the earth.
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:
Post a Comment