Reputation: 141
In VisiData 1.5.2
, how can I add a new column which contains the row number?
This can be done in version 2.0
by pressing i
I think, but that does not work in 1.5.2
. When I try that it says:
no command for "i"
Maybe there's a way of referencing the current row number in a expression?
Upvotes: 1
Views: 267
Reputation: 36
This is more complicated than i
, but it will work!
Use za
to create a new column. Then move your cursor to that column, and press gs
, then gz=
. Type in range(n) where n
is the number of rows in your sheet (you can reference the number in the buttom right corner).
Another option is that you can try putting the code for i
(https://github.com/saulpw/visidata/blob/e2bbb7f60e069297f5da86f1cbe6faf3f606f72e/visidata/incr.py) in your installation of VisiData, and see if it 'just' works. VisiData's code was intentionally made very modular to allow for easier plug and play possibilities. Just make sure to add it to your imports in the __init__
file as well: https://github.com/saulpw/visidata/blob/2cb5379f413dc9d7f0baae3e4f351bb7268efb32/visidata/__init__.py#L101
Upvotes: 2