On Fri, Jan 29, 2016, at 23:46, Hongyi Zhao wrote: > Hi all, > > I can use the following methods for mimicking tac command bellow: > > awk '{a[NR]=$0} END {while (NR) print a[NR--]}' input_file > perl -e 'print reverse<>' input_file
Well, both of those read the whole file into memory - tac is sometimes smarter than that, but that makes for a more complex program. And python doesn't really do "one-liners" like that, so it doesn't look quite as nice. But combined with some shell constructs you can do: python <(echo 'import sys;print("".join(reversed(list(sys.stdin))))') -- https://mail.python.org/mailman/listinfo/python-list