Chinaunix首页 | 论坛 | 博客
  • 博客访问: 68328
  • 博文数量: 9
  • 博客积分: 2426
  • 博客等级: 大尉
  • 技术积分: 100
  • 用 户 组: 普通用户
  • 注册时间: 2009-02-19 13:55
文章分类

全部博文(9)

文章存档

2010年(3)

2009年(6)

分类:

2009-07-30 22:43:38

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

看明白了吗
阅读(1723) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~