Skip to main content
4 of 11
added 220 characters in body
Stéphane Chazelas
  • 586.3k
  • 96
  • 1.1k
  • 1.7k

If you add a | sed -n l to that tail command, to show non-printable characters, you'll probably see something like:

N\bNA\bAM\bME\bE 

That is, each character is written as X Backspace X. On modern terminals, the character ends up being written over itself with no difference. But in ancient tele-typewriters, that would cause the character to appear in bold as it gets twice as much ink.

Still, pagers like more/less do understand that format to mean bold, so roff, and that's still what roff does to output bold text.

Some man implementations would call roff in a way that those sequences are not used (or internally call col -b -p -x like in the case of the man-db implementation), and don't invoke a pager when they detect the output is not going to a terminal (so man bash | grep NAME would work there), but not yours.

You can use col -b to remove those sequences (there are other types (_ BS X) as well for underline).

For systems using GNU roff (like GNU or FreeBSD), you can avoid those sequences being used in the first place by making sure the -c -b -u options are passed to grotty, for instance by making sure the -P-cbu options is passed to groff.

For instance by creating a wrapper script called groff containing:

#! /bin/sh - exec /usr/bin/groff -P-cbu "$@" 

That you put ahead of /usr/bin/groff in $PATH.

With macOS' man (also using GNU roff), you can create a man-no-overstrike.conf with:

NROFF /usr/bin/groff -mandoc -Tutf8 -P-cbu 

And call man as:

man -C man-no-overstrike.conf bash | grep NAME 
Stéphane Chazelas
  • 586.3k
  • 96
  • 1.1k
  • 1.7k