我知道less +/pattern filename会打开文件并导航到模式的第一次出现。有没有办法告诉less从最后向后搜索?它甚至接受多个+开关吗?
不工作:
less +?pattern filename
less +G +?pattern filename
Run Code Online (Sandbox Code Playgroud)
声明语法的man页面less是less +?pattern filename
?pattern
Search backward in the file for the N-th line containing the
pattern. The search starts at the last line displayed (but see
the -a and -j options, which change this).
Run Code Online (Sandbox Code Playgroud)
按n继续向后搜索花样。按N向前搜索图案。
例子
对于testfile.txt的
apple
banana
carrot
apple
banana
carrot
apple
banana
carrot
Run Code Online (Sandbox Code Playgroud)
less +?banana testfile.txt 显示以下内容:
banana
carrot
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14106 次 |
| 最近记录: |