我有一个名为test的文本文件,其中的内容如下:
Pigeon is the world's oldest domesticated bird.
Research suggests that domestication of pigeons was as early as ten thousand years ago.
People who keep domestic pigeons are generally called pigeon fanciers.现在我想得到这样的结果,句子的顺序相反:
People who keep domestic pigeons are generally called pigeon fanciers.
Research suggests that domestication of pigeons was as early as ten thousand years ago.
Pigeon is the world's oldest domesticated bird. 我该怎么做?
发布于 2013-09-15 16:37:48
您可以使用tac命令:
$ tac file发布于 2013-09-15 16:39:20
你试过这个吗?
tail -r myfile.txt发布于 2013-09-15 16:41:59
只是为了好玩:
nl file | sort -nr | cut -b8-与基于尾的解决方案不同,它处理整个文件。不过,我不认为它优雅或高效。
https://stackoverflow.com/questions/18814749
复制相似问题