Using ROT13 Encoding with sed

In Usenet newsgroups (among other places), text is often encoded with something called ROT13, which is an abbreviation for “rotate (the alphabet by) 13.” That is, A becomes N, B becomes O, and so forth. If text is encoded, people have to take extra steps to decode the message. For example, if a message includes an offensive joke, people who don’t want to see the joke won’t have to. Similarly, if the message is a movie review, people who don’t want to know the ending won’t have the surprise spoiled. Instead, the message encoded with ROT13 might look like this:

Tbbq sbe lbh--lbh svtherq vg bhg! Naq ab,
gurer'f ab chapuyvar. Ubcr lbh rawblrq
gur obbx! Qrobenu naq Revp

A great way to use ROT13 encoding (and decoding) ...

Get Unix Third Edition: Visual Quickstart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.