最近在学习shell,而CU里面比较火的帖子是网中人《shell十三问?》和wingger《基础十二篇》,在这里先感谢两位大大为吾等新手提供这么好的资料。以下是自己摘自跟贴网友的一部分内容,如有错误,麻烦各位指点轻拍,哇嘎嘎。
egrep,extended grep,egrep接受所有的正则表达式,一个比较特殊的地方就是有-f选项,后接文件名,egrep从该文件中得到匹配模式,每次从文件中取出一行。如果该文件为空,则不匹配任何内容。例如:
- lee@ubuntu:~/shell_study/test_grep$ cat -E grepstrings
- 484$
- 47$
- lee@ubuntu:~/shell_study/test_grep$ cat -E data.f
- 48 Dec 3BC1977 LPSX 68.00 LVX2A 138$
- $
- 483 Sept 5AP1996 USP 65.00 LVX2C 189$
- 47 Oct 3ZL1998 LPSX 43.00 KVM9D 512$
- 219 dec 2CC1999 CAD 23.00 PLV2C 68$
- 484 nov 7PL1996 CAD 49.00 PLV2C 234$
- 483 may 5PA1998 USP 37.00 KVM9D 644$
- 216 sept 3ZL1998 USP 86.00 KVM9E 234$
- lee@ubuntu:~/shell_study/test_grep$ grep -f grepstrings data.f
- 47 Oct 3ZL1998 LPSX 43.00 KVM9D 512
- 484 nov 7PL1996 CAD 49.00 PLV2C 234