Did `man ls > temp.txt`. Output textfile is corrupted When I execute man ls &gt; temp.txt the output text file is corrupted. By corrupted I mean that first and last letters in some words are overly repeated.

Several first lines in temp.txt:

LS(1)                     BSD General Commands Manual                    LS(1)

NNAAMMEE
     llss -- list directory contents

SSYYNNOOPPSSIISS
     llss [--AABBCCFFGGHHLLOOPPRRSSTTUUWW@@aabbccddeeffgghhiikkllmmnnooppqqrrssttuuwwxx11] [_f_i_l_e _._._.]

DDEESSCCRRIIPPTTIIOONN


And so on. Without redirection man ls is perfectly normal. What's happening?
From man man:

To get a plain text version of a man page, without backspaces and underscores, try
    # man foo | col -b &gt; foo.mantxt


man prints formatted version of man page, underscores and double letters are parsed

Its not so much that they are 'parsed' but rather &quot;if you don't have a terminal, bold format is to be displayed as a repeated character&quot;. Once you hook it up to a terminal (vt100, xterm, Terminal, etc...), man recognizes the terminal and sends the appropriate control codes to do color, bold, underline and the like. Its being parsed correctly - just for a null terminal type.

 comment by MichaelT