gpt4 book ai didi

linux - 如何让 Linux 使用 cat 只显示文本文件中的最后一段?

转载 作者:太空宇宙 更新时间:2023-11-04 12:33:30 25 4
gpt4 key购买 nike

我有一份学校作业,内容如下:

Use the cat command, suitably modified, to show only the last paragraph in the 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 文件 |尾-n1

关于linux - 如何让 Linux 使用 cat 只显示文本文件中的最后一段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42649906/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com