Sample Header Ad - 728x90

Reversing a file line-wise and character-wise

5 votes
4 answers
2072 views
Input:
hello
enrico
output:
ocirne
olleh
To do this, I can simply tac a file and pipe the output to rev (or the other way around), so one function that does the job is just this:
revtac() { tac "$@" | rev; }
Is there a built-in function for the job? I suspect that this could potentially break something, as it would reverse ` and ` on Windows-generated files, but I'm still interested.
Asked by Enlico (2258 rep)
Jul 15, 2020, 12:34 PM
Last activity: Sep 15, 2024, 05:27 AM