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 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?
The MacOs version of
tailsupport the-r(“reverse”) option, and defaultsto displaying the entire file from the end. So
tail -r filenameshould beexactly equivalent to
tac filename.Or, you could try building tac yourself from the source code. It’s part of the GNU coreutils package.