您的位置:首页 > 运维架构 > Linux

Linux之正则表达式与文件格式化处理

2016-08-08 21:27 260 查看
正则表达式主要是用在对字符串进行处理。注意一点的是正则表达式与通配符是完全不一样的东西,开机过程中的相关程序都在/etc/init.d

1.grep详解

grep最重要的功能就是进行数据比对时,然后将符合要求的字符串打印出来,注意grep在数据查找时,是以一个“整行”为单位来进行数据获取的

以下面这个文本为例子解释grep。

"Open Source" is a good mechanism to develop programs.
apple is my favorite food.
Football game is not use feet only.
this dress doesn't fit me.
However, this dress is about $ 3183 dollars.
GNU is free air not free beer.
Her hair is very beauty.
I can't finish the test.
Oh! The soup taste good.
motorcycle is cheap than car.
This window is clear.
the symbol '*' is represented as start.
Oh! My god!
The gd software is a library for drafting programs.
You are the best is mean you are the no. 1.
The world <Happy> is the same with "glad".
I like dog.
google is the best tools for search keyword.
goooooogle yes!
go! go! Let's go.
# I am VBird


搜索特定字符串

搜索带有’the’



反向搜索,搜索没有’the’的



要取得部分大小写的’the’字符串



利用中括号[]来搜索集合字符



如果要搜索带有’oo’的字符





我想’oo’字符前没有小写字母



要取有数字的一行



也可以这样



423
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: