l0f...@tuta.io wrote: > Hi, > > Strictly speaking, my question is not on Debian itself, but on usage of less > command running on my Buster (487-0.1+b1). > > Is there a way to save *filtered* less results in a file or on stdout please? > > What I mean by "filtered" is results obtained via "&" or "&!" command inside > less. > > Indeed, commands like "|", "-o" or "s" inside less don't seem to take > filtering into account... > > Thanks in advance :)
if you are going to do something to the contents of a file you can use: $ grep "pattern" filename > output there are different versions of grep command (egrep and fgrep too besides just grep - check the man pages). if you are taking the input to grep from some other command you can pipe the output of that command to the grep command and then redirect what comes out of that into a file: $ command | grep pattern > outputfile less and more are what most would consider pager programs and not really all that oriented towards filtering like grep. for more complicated kinds of output processing you can use awk/gawk or many other things available. i never much got into perl. i think more modern peoples use perl instead of grep/awk/etc. :) songbird