Let's say we list /usr/bin
with ls
– this may look like:
CC file2c man sscop
Mail find mandoc ssh
addftinfo finger manpath ssh-add
addr2line flex merge ssh-agent
...
but we could also use ls -1
, and we get:
CC
Mail
addftinfo
addr2line
afmtodit
alias
apply
apropos
...
A list with all filenames, each of them in a single line. The structure of the output is: filename, newline (\n
), …
This we can pipe to less
: ls -1 | less
.
Now, is it possible to easily apply a command to the string contained in the current line?
How exactly this is done is irrelevant, just the number of steps should be small. It could be by using !
in less (this doesn't seem possible?) or by somehow getting the string contained in the current line into a shell variable etc.
Under Xorg this is easy of course, by just using the middle mouse button paste. But in text mode, can one do it in a not too complicated way?
pasting
have to with that? Don't you rather want to copy the top line? – Arkadiusz Drabczyk Sep 27 '17 at 8:45GNU screen
ortmux
but you'd have to have it started before openingless
. – Arkadiusz Drabczyk Sep 27 '17 at 8:53pick
can do (ormc
): Interactively searching in a directory for a filename and then applying a command to the found file. But obviously, doing it with basic unix tools. To a certain degree it can be done with vim, which is nearly always installed, yet only in a cumbersome way. – viuser Sep 28 '17 at 0:05