4 ms·
"Since this is just a reverse version of cat, I called the program recat." Curious if you compared the end result with "tac". Source: https://github.com/coreu
by tyingq 6y ago
"Since this is just a reverse version of cat, I called the program recat."
Curious if you compared the end result with "tac".
Source: https://github.com/coreutils/coreutils/blob/master/src/tac.c https://github.com/coreutils/coreutils/blob/master/src/tac.c
Walkthrough of how it works: http://www.maizure.org/projects/decoded-gnu-coreutils/tac.html http://www.maizure.org/projects/decoded-gnu-coreutils/tac.ht...
- bloak 6y agoSee also "rev": https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/tree/text-utils/rev.c https://git.kernel.org/pub/scm/utils/util-linux/util-linux.g...
- tyingq 6y agoAh, yes, though that reverses each line of text individually while maintaining line order, versus reversing the whole file.
- bewuethr 6y agoThe recat tool shown seems to have the same effect as tac | rev
- tyingq 6y agoAh, I see what it does now, thanks for that. It's not exactly the same as "tac | rev" though. For a typical text file with each line ending in a newline...this recat tool outputs a newline first, and the last line is missing a newline. So it's a true reverse printing of last byte to first.
- _kst_ 6y agoYears ago, I wrote a filter that reversed lines and reversed characters within each line after padding with blanks. I ran a text file through it, printed the result, turned the paper upside down, and complained to a sysadmin that the printer was rotating each character in place. (I didn't keep them hanging for long.)