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

正则表达式主要是用在对字符串进行处理。注意一点的是正则表达式与通配符是完全不一样的东西,开机过程中的相关程序都在/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
  1. 搜索特定字符串
    搜索带有’the’
    这里写图片描述
    反向搜索,搜索没有’the’的
    这里写图片描述
    要取得部分大小写的’the’字符串
    这里写图片描述
  2. 利用中括号[]来搜索集合字符
    这里写图片描述
    如果要搜索带有’oo’的字符
    这里写图片描述
    这里写图片描述
    我想’oo’字符前没有小写字母
    这里写图片描述
    要取有数字的一行
    这里写图片描述
    也可以这样
    这里写图片描述
    423
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值