以命令grep为工具来学习,实验数据为”regular_express.txt“,参考《鸟哥的linux私房菜》。
Usage:gerp [oprtion]... Pattern [File]...
grep命令是以一行为搜索对象的,即当某行包含“搜素字符串”时,它就会列出这行。
参数说明:
-c : 就算包含”搜索字符串“的行数
-i : 忽略大小写
-n : 在结果中添加行数
-v : 反向选择,即把不包含”搜索字符串“的行列出来
jack@ggiiss:/home/administrator/桌面$ grep 'the' regular_express.txt
I can't finish the test.
the symbol '*' is represented as start.
You are the best is mean you are the no. 1.
The world <Happy> is the same with "glad".
google is the best tools for search keyword.
jack@ggiiss:/home/administrator/桌面$ grep -n 'the' regular_express.txt
8:I can't finish the test.
12:the symbol '*' is represented as start.
15:You are the best is mean you are the no. 1.
16:The world <Happy> is the same with "glad".
18:google is the best tools for search keyword.
jack@ggiiss:/home/administrator/桌面$ grep -vn 'the' regular_express.txt
1:"Open Source" is a good mechanism to develop programs.
2:apple is my favorite food.
3:Football game is not use feet only.
4:this dress doesn't fit me.
5:However, this dress is about $ 3183 dollars.
6:GNU is free air not free beer.
7:Her hair is very beauty.
9:Oh! The soup taste good.
10:motorcycle is cheap than car.
11:This window is clear.
13:Oh! My god!
14:The gd software is a library for drafting programs.
17:I like dog.
19:goooooogle yes!
20:go! go! Let's go.
21:# I am VBird
22: