[英]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.