Skip to content
Advertisement

set line-increment in nl command to a float number

I want to use nl command to do numbering for lines. Is it possible to set line-increment in nl command to a float number.
I know that we cant use -i switch to set line-increment like this:

JavaScript

but it doesn’t work for float numbers like:

JavaScript

I want the output to be like this

JavaScript

Advertisement

Answer

Could use awk instead

JavaScript

With padding (up to 99999 lines, for more add higher number in printf)

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement