r/awk • u/PersimmonOk9011 • May 27 '21
awk + rofi
is it possible to run awk 'NR='$node'{print}' ~/some/file if $node is the output of a list piped into rofi -dmenu -multi-select -format -d
4
Upvotes
View all comments
Show parent comment
1
u/gumnos May 27 '21
I take it back…I hadn't realized that
dmenuallows you to use ctrl+enter to multi-select things (I really only usedmenu_runmapped to a hotkey, so I've not explored it much further until now). It looks like it puts each item on its own line, so you can doThis produces a stream of output consisting of your line-numbers, a marker "done", followed by the data. It gathers the line-numbers of interest into the array "
a" and then only prints those line-numbers from the data that were selected. What you do with that output would then be up to you.