[英]How to get Linux to only show the last paragraph in a text file using cat?
我有一個學校作業,內容如下:
使用經過適當修改的
cat
命令,僅顯示textfile
的最后一段
我已經檢查過https://unix.stackexchange.com/questions/308032/modifying-cat-command-to-number-paragraphs-and-display-last-paragraph-only ,但這不是很有幫助。
我知道您可以在沒有 cat
情況下執行此操作,但是我的學校說我必須使用cat
命令。
謝謝! ;)
編輯:我用cat -n thefile | tail -n1
cat -n thefile | tail -n1
,它工作完美。 謝謝彼得·鮑耶!
假設您每行有一個段落.....
cat -n thefile | tail -n1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.