- 论坛徽章:
- 0
|
本帖最后由 wwr 于 2014-02-03 22:15 编辑
我想通过grep筛选指定关键字符的文件:ch01,ch02,wch01- [root@butter awk]# ll
- total 24
- -rwxr--r-- 1 root root 159 Dec 3 16:36 byState
- -rw-r--r-- 1 root root 60 Feb 3 21:37 ch01
- -rw-r--r-- 1 root root 62 Feb 3 21:42 ch02
- -rw-r--r-- 1 root root 66 Feb 3 21:44 ch03
- -rw-r--r-- 1 root root 342 Jan 29 21:55 list
- -rw-r--r-- 1 root root 101 Dec 3 16:34 nameState
- -rw-r--r-- 1 root root 42 Feb 3 21:45 wch01
复制代码 无论尝试怎么么做,都没有任何反馈- [root@butter awk]# ll|awk '{print $9}'|grep ch0[12]
- [root@butter awk]# ll|grep ch0[12]
复制代码 即使把grep替换成egrep
后来我又用awk的筛选功能,居然发现成功了:- [root@butter awk]# ll|awk '/ch0[12]/ {print}'
- -rw-r--r-- 1 root root 60 Feb 3 21:37 ch01
- -rw-r--r-- 1 root root 62 Feb 3 21:42 ch02
- -rw-r--r-- 1 root root 42 Feb 3 21:45 wch01
复制代码 RHEL6.3 求解释…… |
|