在使用'less'命令时在Unix中显示特殊字符 [英] Show special characters in Unix while using 'less' Command
问题描述
我想知道如何在使用'less'命令时查看特殊字符。例如,我想看到不可打印的字符与一个特殊的符号。例如在vi编辑器中,我使用set list on来查看由美元$字符表示的行终止字符。类似地,我想使用'less'命令。
我引用Unix少了手动,但是没有效果。
在其环境中查看是否有一个名为LESS的变量
你的〜/ .profile(.bash_rc等等),然后任何时候从命令行运行少
,它会找到LESS。
尝试添加此
export LESS = - CQaix4
这是我使用的设置,有一些嵌入的行为可能会混淆你,所以...
您可以从更少
中的帮助功能中找出所有这些意味着什么,只需点击h键和鼻子,
$ b
编辑
,并注意到还有一个-r选项 -r -R .... --raw-control-chars - -RAW-CONTROL-CHARS
输出原始控制字符。
我同意猫可能是您所声明需求的最准确匹配。
cat -vet文件|
在每一行的末尾添加'$',并将tab char转换为visual'^ I' 。
cat --help
(编辑)
-e相当于-vE
- E,--show-ends在每行末尾显示$
-t等效于-vT
-T,--show-tabs显示TAB字符为^ I
-v, - -show-nonprinting使用^和M-符号,除了LFD和TAB
我希望这有帮助。
I would like to know how to view special characters while using 'less' command. For instance I want to see the non-printable characters with a special notation. For instance in 'vi' editor I use "set list on" to see the line termination characters represented by dollar '$' character. Similarly I would want to do this using 'less' command.
I referred Unix less manual, but to no avail.
less will look in its environment to see if there is a variable named LESS
You can set LESS in one of your ~/.profile (.bash_rc, etc, etc) and then anytime you run less
from the comand line, it will find the LESS.
Try adding this
export LESS="-CQaix4"
This is the setup I use, there are some behaviors embedded in that may confuse you, so ...
You can find out about what all of these mean from the help function in less
, just tap the 'h' key and nose around, or run less --help.
edit
I looked at the help, and noticed there is also an -r option
-r -R .... --raw-control-chars --RAW-CONTROL-CHARS
Output "raw" control characters.
I agree that cat may be the most exact match to your stated needs.
cat -vet file | less
Will add '$' at end of each line and convert tab char to visual '^I'.
cat --help
(edited)
-e equivalent to -vE
-E, --show-ends display $ at end of each line
-t equivalent to -vT
-T, --show-tabs display TAB characters as ^I
-v, --show-nonprinting use ^ and M- notation, except for LFD and TAB
I hope this helps.
这篇关于在使用'less'命令时在Unix中显示特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!