3 ms·
Good tips. Small correction: `&` only filters by the most recent pattern.
by hddqsb 5y ago
Good tips. Small correction: `&` only filters by the most recent pattern.
- philsnow 5y agoSeems to depend on your particular less, see the last sentence of this paragraph from `man less` on my machine: &pattern Display only lines which match the pattern; lines which do not match the pattern are not displayed. If pattern is empty (if you type & immediately followed by ENTER), any filtering is turned off, and all lines are displayed. While filtering is in effect, an ampersand is displayed at the beginning of the prompt, as a reminder that some lines in the file may be hidden. Multiple & commands may be entered, in which case only lines which match all of the patterns will be displayed. Indeed, I thought it would behave like you describe.. when I was refreshing my memory of how the negative pattern filtering worked, I first did &/pattern and then &/^Npattern, and was surprised to see that it displayed zero matching lines. this is my version of less: % less --version less 581.2 (POSIX regular expressions) Copyright (C) 1984-2021 Mark Nudelman
- hddqsb 5y agoOh wow, that's a pretty new feature! It was added in v569, 2020[1]. [1]: https://github.com/gwsw/less/commit/6a070fc53799fb86e0fe38806d52b7ab72bd3aa4 https://github.com/gwsw/less/commit/6a070fc53799fb86e0fe3880...