methods
-
tac
-
install on mac
$ brew install coreutils ==> Downloading https://ftp.gnu.org/gnu/coreutils/coreutils-8.30.tar.xz ######################################################################## 100.0% ==> ./configure --prefix=/usr/local/Cellar/coreutils/8.30 --program-prefix=g --without-gmp ==> make install ==> Caveats All commands have been installed with the prefix 'g'. If you really need to use these commands with their normal names, you can add a "gnubin" directory to your PATH from your bashrc like: PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" Additionally, you can access their man pages with normal names if you add the "gnuman" directory to your MANPATH from your bashrc as well: MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH" ==> Summary 🍺 /usr/local/Cellar/coreutils/8.30: 430 files, 8.8MB, built in 4 minutes 26 seconds
-
$ ln -s /usr/local/bin/gtac /usr/local/bin/tac
-
-
cat
-
use -r
$ cat -r file.txt
-
-
sed
-
use cat -n
$ cat -n file.txt | grep needle 11344 sth bla bla needle bla bla sth
-
use sed -n
$ sed -n 11344,11444p file.txt ...
-