从猫输出/就像少它的显示复制 [英] Copy output from cat/less just like it's displayed
问题描述
我想要做的就是复制的输出,你会用手动复制粘贴做。这主要是指无法识别的字符将被保存为?但是还是显示它们,而不是他们的CHAR codeS。有没有办法做到这一点?
What I want to do is to copy the output as you would do with a manual copy-paste. That mostly means that unrecognised characters will be saved as ? or however they are displayed, and not as their char codes. Is there any way to do that?
推荐答案
如果你有什么你正在试图解决,我可以更具体。例如
If you had examples of what you are trying to solve, I could be more specific.
现在,我只能指向你。
- 少-SR (展示间preting ANSI逃逸)
- ansifilter 以转换ANSI逃脱文本为纯文本(或HTML等)
- 的iconv ,例如
- less -SR (show interpreting ANSI escapes)
- ansifilter to convert ANSI escaped text to plain text (or HTML etc)
- iconv, e.g.
cat myfile | iconv -f utf8 -t iso8859-1
当然,与去年一,替代以往的字符集是什么,你都涉及
Of course with that last one, substitute what ever character sets you have involved
我刚刚制定了两个最有可能的设置,将做什么,我想您所描述:
I just worked out the two most likely settings that will do what I think you are describing:
cat position | iconv -t latin1//TRANSLIT
cat position | iconv -t ASCII//TRANSLIT
如果您有一个UNI code-重文件位置
是这样的:
If you have a UNICODE-heavy file position
like this:
--> Applying move 131, ply 262: Q d3 - e2 + Checkmate .
... situation after:
⒏ ┊. . . . . . . .
⒎ ┊. . ♟ . . . . .
⒍ ┊. . ♙ . . . . .
⒌ ┊. . ♙ . ♙ . . ♟
⒋ ┊. . . . ♘ ♜ . ♚
⒊ ┊. . . ▫ . . . .
⒉ ┊. ♜ . . ♛ . . .
⒈ ┊. . . . ♔ . ♗ .
└────────────────
Ⓐ Ⓑ Ⓒ Ⓓ Ⓔ Ⓕ Ⓖ Ⓗ
会得到这样的:
--> Applying move 131, ply 262: Q d3 - e2 + Checkmate .
... situation after:
8. ?. . . . . . . .
7. ?. . ? . . . . .
6. ?. . ? . . . . .
5. ?. . ? . ? . . ?
4. ?. . . . ? ? . ?
3. ?. . . ? . . . .
2. ?. ? . . ? . . .
1. ?. . . . ? . ? .
+----------------
(A) (B) (C) (D) (E) (F) (G) (H)
这篇关于从猫输出/就像少它的显示复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!