ฉันจะเปลี่ยนเส้นทางเนื้อหาของเทอร์มินัล (เนื้อหาที่ขณะนี้ฉันกำลังมองหาไฟล์ทั้งหมดไม่ได้เมื่อใช้lessคำสั่ง) เป็น outfile จนกว่าฉันจะกดQเพื่อออกจากless?
ฉันจะเปลี่ยนเส้นทางเนื้อหาของเทอร์มินัล (เนื้อหาที่ขณะนี้ฉันกำลังมองหาไฟล์ทั้งหมดไม่ได้เมื่อใช้lessคำสั่ง) เป็น outfile จนกว่าฉันจะกดQเพื่อออกจากless?
คำตอบ:
หากต้องการบันทึกเฉพาะส่วนที่แสดงอยู่ในเทอร์มินัลของคุณคุณสามารถใช้|คำสั่ง
จากman less:
| <m> shell-command
<m> represents any mark letter. Pipes a section of the input file to the given
shell command. The section of the file to be piped is between the first line on the
current screen and the position marked by the letter. <m> may also be '^' or '$' to
indicate beginning or end of file respectively.
If <m> is '.' or newline, the current screen is piped.
|(สัญลักษณ์ไปป์).เครื่องหมายเพื่อเลือกเฉพาะสิ่งที่มองเห็นได้ในเทอร์มินัลของคุณ (หรือเพียงแค่กดEnter)teeสำหรับบันทึกเป็นไฟล์เช่นtee /tmp/section_of_big_file.txtลำดับที่มีภาพหน้าจอ:



cat foo | less -o barที่barเป็นไฟล์ที่ส่งออกและfooแฟ้มใส่?