관련 항목: (grep inside less)grep이 적나요?
관련 항목: (파일에 적게 저장)https://superuser.com/questions/290908/how-can-i-save-the-current-contents-of-less-to-a-file
결과 입력을 필터링 &<regex>
한 다음 필터링되지 않은 결과가 포함된 파일을 저장할 때. 필터링된 결과만 저장할 수 있나요?
답변1
탐색 후 man less
다음 옵션을 찾았습니다.
-ofilename or --log-file=filename
Causes less to copy its input to the named file as it is being viewed. This applies only when the input file is a pipe, not an ordinary file. If the file already exists, less will ask for
confirmation before overwriting it.
-Ofilename or --LOG-FILE=filename
The -O option is like -o, but it will overwrite an existing file without asking for confirmation.
If no log file has been specified, the -o and -O options can be used from within less to specify a log file. Without a file name, they will simply report the name of the log file. The "s"
command is equivalent to specifying -o from within less.
따라서 이와 같은 작업을 수행하면 출력 파일을 볼 때 cat big_file.txt | less --log-file=output.txt
얻을 수 있는 출력이 됩니다 .less