您可以在终端中使用tac命令吗? [英] Can you use the tac command in Terminal?

查看:88
本文介绍了您可以在终端中使用tac命令吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从命令行(使用终端)以相反的顺序搜索大文件。我找到了tac命令: http://clifgriffin.com/2008/ 11/25 / tac-and-reverse-grep /

I'm trying to search a large file in reverse order from the command line (using terminal). I found the tac command: http://clifgriffin.com/2008/11/25/tac-and-reverse-grep/

tac是cat的倒数。但是,当我尝试在终端中使用tac命令时,它说该命令不存在。有什么方法可以在终端中使用tac?还有哪些其他快速方法可以通过命令行从头开始搜索文件?

tac is the inverse of cat. However, when I try to use the tac command in terminal, it says that command doesn't exist. Is there a way I'd be able to use tac in terminal? What are some other fast ways to search a file from the end via the command line?

推荐答案

MacOS版本的 tail 支持 -r (反向)选项,默认
从头开始显示整个文件。因此, tail -r文件名应该与
完全等效于 tac文件名

The MacOs version of tail support the -r ("reverse") option, and defaults to displaying the entire file from the end. So tail -r filename should be exactly equivalent to tac filename.

或者,您可以尝试从源代码自己构建tac。它是GNU coreutils 程序包的一部分。

Or, you could try building tac yourself from the source code. It's part of the GNU coreutils package.

这篇关于您可以在终端中使用tac命令吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆