Linux 我的文本文件的 cat 和 less 输出与 gedit 和其他 gnome 编辑器不同
Linux cat and less output for my text file is different from gedit and other gnome editor
我将 ri 的 ruby 数组文档重定向到一个文件中,但它在 gedit 中看起来不太好。但是文本在 cli 中看起来很好。这就是我的文件在终端编辑器中的样子。这里一切都很好
= Array#to_param
(from gem activesupport-5.1.3)
------------------------------------------------------------------------------
to_param()
------------------------------------------------------------------------------
Calls to_param on all its elements and joins the result with slashes. This is
used by url_for in Action Pack.
= Array#to_query
(from gem activesupport-5.1.3)
------------------------------------------------------------------------------
to_query(key)
------------------------------------------------------------------------------
Converts an array into a string suitable for use as a URL query string, using
the given key as the param name.
['Rails', 'coding'].to_query('hobbies') # => "hobbies%5B%5D=Rails&hobbies%5B%5D=coding"
= Array#to_s
(from ruby core)
------------------------------------------------------------------------------
to_s()
------------------------------------------------------------------------------
(from gem activesupport-5.1.3)
------------------------------------------------------------------------------
to_s(format = :default)
------------------------------------------------------------------------------
= Array#to_sentence
(from gem activesupport-5.1.3)
------------------------------------------------------------------------------
to_sentence(options = {})
------------------------------------------------------------------------------
但是当我在 gedit 或其他 gnome 编辑器中打开它时,它就是这个样子。一些特定的词看起来很荒谬。任何建议或帮助将不胜感激。
= AArrrraayy##ttoo__ffoorrmmaatttteedd__ss
(from gem activesupport-5.1.3)
------------------------------------------------------------------------------
to_formatted_s(format = :default)
------------------------------------------------------------------------------
Extends Array#to_s to convert a collection of elements into a comma separated
id list if :db argument is given as the format.
Blog.all.to_formatted_s(:db) # => "1,2,3"
Blog.none.to_formatted_s(:db) # => "null"
[1,2].to_formatted_s # => "[1, 2]"
= AArrrraayy##ttoo__ppaarraamm
(from gem activesupport-5.1.3)
------------------------------------------------------------------------------
to_param()
------------------------------------------------------------------------------
Calls to_param on all its elements and joins the result with slashes. This is
used by url_for in Action Pack.
= AArrrraayy##ttoo__qquueerryy
(from gem activesupport-5.1.3)
------------------------------------------------------------------------------
to_query(key)
------------------------------------------------------------------------------
Converts an array into a string suitable for use as a URL query string, using
the given key as the param name.
['Rails', 'coding'].to_query('hobbies') # => "hobbies%5B%5D=Rails&hobbies%5B%5D=coding"
= AArrrraayy##ttoo__ss
(from ruby core)
------------------------------------------------------------------------------
to_s()
------------------------------------------------------------------------------
(from gem activesupport-5.1.3)
------------------------------------------------------------------------------
to_s(format = :default)
------------------------------------------------------------------------------
= AArrrraayy##ttoo__sseenntteennccee
(from gem activesupport-5.1.3)
------------------------------------------------------------------------------
to_sentence(options = {})
------------------------------------------------------------------------------
我尝试在每个系统中打开它。但是除了像 cat 或 less 这样的终端编辑器之外,文本仍然到处都是乱七八糟的。
跟文字编码有关系吗?
ri
输出格式为 ASCII text, with overstriking
的文档。您可以通过 运行 文件上的 file
命令来检查。
文档的某些部分是粗体,由一些字符、退格键 (^H
) 和第一个字符表示。似乎 gedit 和其他 gnome 编辑器忽略了这些退格字符,使实际字符重复。
您可以像这样只输出 ASCII:
ri Array | col -bx > array.txt
关于 nroff
格式的更多信息的答案:https://unix.stackexchange.com/a/274795
我将 ri 的 ruby 数组文档重定向到一个文件中,但它在 gedit 中看起来不太好。但是文本在 cli 中看起来很好。这就是我的文件在终端编辑器中的样子。这里一切都很好
= Array#to_param
(from gem activesupport-5.1.3)
------------------------------------------------------------------------------
to_param()
------------------------------------------------------------------------------
Calls to_param on all its elements and joins the result with slashes. This is
used by url_for in Action Pack.
= Array#to_query
(from gem activesupport-5.1.3)
------------------------------------------------------------------------------
to_query(key)
------------------------------------------------------------------------------
Converts an array into a string suitable for use as a URL query string, using
the given key as the param name.
['Rails', 'coding'].to_query('hobbies') # => "hobbies%5B%5D=Rails&hobbies%5B%5D=coding"
= Array#to_s
(from ruby core)
------------------------------------------------------------------------------
to_s()
------------------------------------------------------------------------------
(from gem activesupport-5.1.3)
------------------------------------------------------------------------------
to_s(format = :default)
------------------------------------------------------------------------------
= Array#to_sentence
(from gem activesupport-5.1.3)
------------------------------------------------------------------------------
to_sentence(options = {})
------------------------------------------------------------------------------
但是当我在 gedit 或其他 gnome 编辑器中打开它时,它就是这个样子。一些特定的词看起来很荒谬。任何建议或帮助将不胜感激。
= AArrrraayy##ttoo__ffoorrmmaatttteedd__ss
(from gem activesupport-5.1.3)
------------------------------------------------------------------------------
to_formatted_s(format = :default)
------------------------------------------------------------------------------
Extends Array#to_s to convert a collection of elements into a comma separated
id list if :db argument is given as the format.
Blog.all.to_formatted_s(:db) # => "1,2,3"
Blog.none.to_formatted_s(:db) # => "null"
[1,2].to_formatted_s # => "[1, 2]"
= AArrrraayy##ttoo__ppaarraamm
(from gem activesupport-5.1.3)
------------------------------------------------------------------------------
to_param()
------------------------------------------------------------------------------
Calls to_param on all its elements and joins the result with slashes. This is
used by url_for in Action Pack.
= AArrrraayy##ttoo__qquueerryy
(from gem activesupport-5.1.3)
------------------------------------------------------------------------------
to_query(key)
------------------------------------------------------------------------------
Converts an array into a string suitable for use as a URL query string, using
the given key as the param name.
['Rails', 'coding'].to_query('hobbies') # => "hobbies%5B%5D=Rails&hobbies%5B%5D=coding"
= AArrrraayy##ttoo__ss
(from ruby core)
------------------------------------------------------------------------------
to_s()
------------------------------------------------------------------------------
(from gem activesupport-5.1.3)
------------------------------------------------------------------------------
to_s(format = :default)
------------------------------------------------------------------------------
= AArrrraayy##ttoo__sseenntteennccee
(from gem activesupport-5.1.3)
------------------------------------------------------------------------------
to_sentence(options = {})
------------------------------------------------------------------------------
ri
输出格式为 ASCII text, with overstriking
的文档。您可以通过 运行 文件上的 file
命令来检查。
文档的某些部分是粗体,由一些字符、退格键 (^H
) 和第一个字符表示。似乎 gedit 和其他 gnome 编辑器忽略了这些退格字符,使实际字符重复。
您可以像这样只输出 ASCII:
ri Array | col -bx > array.txt
关于 nroff
格式的更多信息的答案:https://unix.stackexchange.com/a/274795