渲染逃生SQUENCE文本(如终端) [英] render text with escape squence (like a terminal)
本文介绍了渲染逃生SQUENCE文本(如终端)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
~$ echo -e "abc\vdef"
abc
def
~$
~$ echo -e "abc\vdef" > /tmp/xxxxx
~$ vi /tmp/xxxxx
我得到了ABC ^ KDEF在屏幕上。
I got abc^Kdef on screen.
所以我在寻找一些工具,能为我做到这一点:
so i'm searching some tool that can do this for me:
~$ sometool /tmp/xxxxx > /tmp/yyyyy
~$ vi /tmp/yyyyy
I can get
abc
def
在vi窗口。
\\ v是只是一个例子,我需要转换\\ V,\\ B,\\ F等。
\v is just a example, I need convert \v, \b, \f, etc.
要harithski:
但我想要的是:
to harithski: but what I want is:
$~/:sometool /tmp/xxxxx > /tmp/yyyyy
在python
in python
>>> f=open('/tmp/yyyyyy').readlines()
>>> f[0]
>>> ['abc\n def']
其中有\\ n和DEF
which has three space between \n and def
推荐答案
别以为我是完全理解的问题,但 OD
要帮助?
Don't think I'm entirely understanding the question, but is od
going to help?
例如:
$ echo -e "abc\vdef" > temp
$ cat temp
abcdef
$ od -c temp
0000000 a b c \v d e f \n
0000010
您可以通过管道将输出通过sed的,如果你想清理。就像我说的,我不知道这是你在问什么。
You could pipe that output through sed if you wanted to clean it up. Like I said, I'm not sure that's what you're asking.
这篇关于渲染逃生SQUENCE文本(如终端)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文