Every now and then you come across something and say, "Gee, that might come in handy someday, but I have no idea for what." This might happen to you when you're browsing at a flea market or garage sale; if you're like us, it might happen when you're browsing through public domain software.
Go to http://examples.oreilly.com/upt3 for more information on: rot
Which brings us to the rot program. rot basically just rotates text columns and rows. For example, the first column below shows an input file. The other three columns show the same file fed through rot once, twice, and three times:
$ cat file |
$ rot file |
$ rot file | rot |
$ rot file | rot | rot |
---|---|---|---|
abcde |
54321 |
5 |
e |
1 |
a |
4 |
d |
2 |
b |
3 |
c |
3 |
c |
2 |
b |
4 |
d |
1 |
a |
5 |
e |
edcba |
12345 |
Now let's compare combinations of rot and tail -r (Section 42.1):
$ cat file |
$ rot file |
$ rot file | tail -r |
$ tail -r file | rot |
---|---|---|---|
abcde |
54321 |
e |
12345 |
1 |
a |
d |
a |
2 |
b |
c |
b |
3 |
c |
b |
c |
4 |
d |
a |
d |
5 |
e |
54321 |
e |
rot rotates the text 90 degrees. tail -r turns the text "upside down" (last line in becomes the first line out, and so forth).
rot can also rotate the output of banner to print down a page instead of across. By now, we hope you have an idea of what rot can do!
--JP and LM
Copyright © 2003 O'Reilly & Associates. All rights reserved.