OS X: "man" 输出在重定向时给出额外的字符
OS X: "man" output giving extra characters when redirected
我正在尝试在 OS X(El Capitan,v10.11.3)终端(bash shell)中做一个简单的输出重定向,我得到了一堆不需要的字符在输出中。这不会发生在 Linux.
例如,如果我输入 man open > open.txt
,我会得到以下结果:
OPEN(1) BSD General Commands Manual OPEN(1)
NNAAMMEE
ooppeenn -- open files and directories
SSYYNNOOPPSSIISS
ooppeenn [--ee] [--tt] [--ff] [--FF] [--WW] [--RR] [--nn] [--gg] [--hh] [--bb _b_u_n_d_l_e___i_d_e_n_t_i_f_i_e_r]
[--aa _a_p_p_l_i_c_a_t_i_o_n] _f_i_l_e _._._. [----aarrggss _a_r_g_1 _._._.]
DDEESSCCRRIIPPTTIIOONN
The ooppeenn command opens a file (or a directory or URL), just as if you had
double-clicked the file's icon. If no application name is specified, the
default application as determined via LaunchServices is used to open the
specified files.
If the file is in the form of a URL, the file will be opened as a URL.
You can specify one or more file names (or pathnames), which are inter-
preted relative to the shell or Terminal window's current working direc-
tory. For example, the following command would open all Word files in the
current working directory:
open *.doc
Opened applications inherit environment variables just as if you had
launched the application directly through its full path. This behavior
was also present in Tiger.
The options are as follows:
--aa aapppplliiccaattiioonn
Specifies the application to use for opening the file
--bb bbuunnddllee__iinnddeennttiiffiieerr
Specifies the bundle identifier for the application to use when open-
ing the file
来自 OS man (man man
) 的 X 手册页:
TIPS
[...]
To get a plain text version of a man page, without backspaces and
underscores, try
# man foo | col -b > foo.mantxt
将此应用于您的示例如下所示:
man open | col -b > open.txt
我正在尝试在 OS X(El Capitan,v10.11.3)终端(bash shell)中做一个简单的输出重定向,我得到了一堆不需要的字符在输出中。这不会发生在 Linux.
例如,如果我输入 man open > open.txt
,我会得到以下结果:
OPEN(1) BSD General Commands Manual OPEN(1)
NNAAMMEE
ooppeenn -- open files and directories
SSYYNNOOPPSSIISS
ooppeenn [--ee] [--tt] [--ff] [--FF] [--WW] [--RR] [--nn] [--gg] [--hh] [--bb _b_u_n_d_l_e___i_d_e_n_t_i_f_i_e_r]
[--aa _a_p_p_l_i_c_a_t_i_o_n] _f_i_l_e _._._. [----aarrggss _a_r_g_1 _._._.]
DDEESSCCRRIIPPTTIIOONN
The ooppeenn command opens a file (or a directory or URL), just as if you had
double-clicked the file's icon. If no application name is specified, the
default application as determined via LaunchServices is used to open the
specified files.
If the file is in the form of a URL, the file will be opened as a URL.
You can specify one or more file names (or pathnames), which are inter-
preted relative to the shell or Terminal window's current working direc-
tory. For example, the following command would open all Word files in the
current working directory:
open *.doc
Opened applications inherit environment variables just as if you had
launched the application directly through its full path. This behavior
was also present in Tiger.
The options are as follows:
--aa aapppplliiccaattiioonn
Specifies the application to use for opening the file
--bb bbuunnddllee__iinnddeennttiiffiieerr
Specifies the bundle identifier for the application to use when open-
ing the file
来自 OS man (man man
) 的 X 手册页:
TIPS
[...]
To get a plain text version of a man page, without backspaces and
underscores, try
# man foo | col -b > foo.mantxt
将此应用于您的示例如下所示:
man open | col -b > open.txt