This may not be very useful in everyday life but i just found this command that is available on Solaris as well as other *Nix platforms. If you want to print contents of a file you simply use command "cat" which will print lines from top to bottom. but if you want to print lines in opposite order then jsut use "tac".
Example :
~> cat test.txt
Line 1
line 2
line3
linne 4
line 5
----------
~> tac test.txt
line 5
linne 4
line3
line 2
Line 1
-----------------------------
As you can see in above example the lines are printed in reverse order.
Example :
~> cat test.txt
Line 1
line 2
line3
linne 4
line 5
----------
~> tac test.txt
line 5
linne 4
line3
line 2
Line 1
-----------------------------
As you can see in above example the lines are printed in reverse order.
No comments:
Post a Comment