linux 忽略大小写的查找

http://www.shocr.com/linux-vim-search-ignore-case/
  1. vim 中的查找

Linux 下 vim搜索文件内容时加上 \c 参数可以忽略搜索字符的大小写.

比如用vim 搜索文件中的 China 时

可用 :/china\c

 

  2. find 查找 

Linux使用find命令搜索文件时如果不清楚文件的名称中是否包含的大写,你可以使用 -iname参数来忽略大小写.

[root@Blinux test]# ll
总用量 0
-rw-rw-r-- 1 Blinux root 0 12月 16 07:42 China
[root@Blinux test]# find ./ -name china
[root@Blinux test]# find ./ -iname china 
./China 

 

  3.grep 查找

  使用管道grep 匹配关键词时如果需要忽略大小写,你可以使用 -i 参数.

[root@Blinux test]# rpm -qa|grep virtualbox
[root@Blinux test]# rpm -qa|grep virtualbox -i 
VirtualBox-3.1-3.1.0_55467_fedora12-1.i686 

 

posted on 2010-10-26 10:43  阿笨猫  阅读(1999)  评论(0编辑  收藏  举报