GREP --color惹的祸

1813阅读 0评论2009-07-30 merlin852
分类:

liunx 为了方便查看输出,特设置
GREP_COLOR=1;46
GREP_OPTIONS=--color=always
这样每次grep时,grep的东西会有特殊颜色显示出来,方便查阅
 
但是今天确给我带来了麻烦

export GREP_COLOR=1;46
export GREP_OPTIONS=--color=always

 

env|grep GREP
GREP_COLOR=1;46
GREP_OPTIONS=--color=always

#env|grep GREP|cut -c1-5


# env|grep GREP|cut -c1-9
GR
GR
#env|grep GREP|cut -c1-12
GREP
     GREP
#env|grep GREP|cut -c1-19
GREP
GREP
#env|grep GREP|cut -c1-20
GREP_
GREP_
#env|grep GREP|cut -c1-25
GREP_COLOR
GREP_OPTIO

 

意想不到吧,有颜色的前面是有特殊字符的,查点害死我了

真正的字符数不止你看到这些

#env|grep GREP >file
#cat file
^[[1;46mGREP^[[00m^[[K_COLOR=1;46
^[[1;46mGREP^[[00m^[[K_OPTIONS=--color=always

看明白了吗
上一篇:oracle归档满了,删除部分归档后 stream不能重新传播数据
下一篇:oracle procedure 通过接口url发短信