in reply to Re: Filter man page control characters?
in thread Filter man page control characters?

That is beautiful. Can you explain?
  • Comment on Re^2: Filter man page control characters?

Replies are listed 'Best First'.
Re^3: Filter man page control characters?
by Thelonius (Priest) on May 18, 2005 at 05:10 UTC
    \010 is the octal escape for ^H. This regex deletes each backspace and the character just before it. With man, an underlined M is _^HM and a bold M is M^HM. Note that on impact printers, these control sequences work. The programs more and less know how to interpret these (more or less) for CRT terminals. But note that if you just cat these to a CRT terminal, you'll still see the letter. The underline sequence could be written as M^H_ and it would still work on a line printer, but would screw up a CRT terminal, so it is purposely not written that way.

    So the regex s/.\010//g is just telling perl to do what the backspace does: delete the character before the backspace.