I like to use
tac to reverse the output of
cat. However, it's not available in the Mavericks terminal. I tried to find it on MacPorts and again it's not available. Can anyone please show me how to get
tac? It's very helpful for reading log files.
- Install Homebrew
brew install coreutils
apparently not needed with latest Homebrew, see comment by Ran Ever-Hadani below
ln -s /usr/local/bin/gtac /usr/local/bin/tac
or use MacPorts to install
coreutils in a similar way.
On OS/X like on many systems (BSDs, Solaris, AIX, IRIX...), the functionality of GNU
tac is available in
tail with the
-r option. So no need to install GNU
tail -r the-file
One temporary solution could be:
alias tac='perl -e "print reverse(<>)"'