how to number lines in a file with sed and paste
file testfile contents:
spam
eggs
foo
bar
number the lines:
sed = testfile | paste -s -d '\t\n' - -
output (written to the terminal):
1 spam
2 eggs
3 foo
4 bar
number the lines and save to a new file:
sed = testfile | paste -s -d '\t\n' - - >testfile.numbered
that’s all folks!
…dave
Wed Oct 25 22:31:46 UTC 2017