我有一组行(item + description),我想通过fzf -m来运行。例如:
item1: Some description
item1: Another description
item2: Yet another description在选择之后,我希望fzf返回行号(例如1 3),而不是行本身,因为: 1)我不想包含描述;2)条目不是唯一的。
是的,我可以先在行号前加上行号:
1: item1: Some description
2: item1: Another description
3: item2: Yet another description然后稍后再提取。但我认为如果能指示fzf这样做,那就太好了。它将使一些事情更容易,并为工具打开更多的可能性。
发布于 2019-06-27 10:58:35
fzf已经可以使用--with-nth将显示的(和搜索的)行更改为原始行的某些字段。因此,我们首先:
1: item1: Some description
2: item1: Another description
3: item2: Yet another description然后使用:
fzf -d: --with-nth 2..这意味着跳过显示第一个字段(字段用冒号分隔)。然后,fzf将返回如下内容:
1: item1: Some description
3: item2: Yet another description从中提取行号。
https://unix.stackexchange.com/questions/527163
复制相似问题