Output Lines of a File in Reverse Order
This page answers questions like these:
- How to output the lines of a file in reverse order?
- How to output the lines of a file from last to first?
- How to cat the lines of a file in reverse order?
Related Links:
Count Occurrences of a Hexadecimal Sequence in a File
Count Occurrences of a String in a File
Find Positions of a Hexadecimal Sequence in a File
Join Lines of Text File Together
Output the Lines Between Two Matching Lines
Output Lines of a Text File in Reverse Order:
tac FILE ...
- Pros: Fast.
- Cons: Only works on systems that have the tac command.
tail -r FILE ...
- Pros: Fast.
- Cons: Only works on systems that have the -r option to tail. Some systems can’t handle large files.
sed '1!G;h;$!d' FILE ...
- Pros: Works on almost all systems.
- Cons: Slow.
ed '1,$g/^/m0' FILE ...
- Pros: Works on almost all systems.
- Cons: Slow.
Related Links:
Count Occurrences of a Hexadecimal Sequence in a File
Count Occurrences of a String in a File
Find Positions of a Hexadecimal Sequence in a File
Join Lines of Text File Together
Output the Lines Between Two Matching Lines
Home > Linux / Unix > Output Lines of a File in Reverse Order
Tags: lines in reverse order, reverse cat, cat in reverse order, linux, unix, solaris, bsd, aix
Copyright © HelpDoco.com
file-output-lines-in-reverse-order.txt
Linux-Unix/output-lines-of-a-file-in-reverse-order.htm
1