I like dog.
google is the best tools for search keyword.
goooooogle yes!
go! go! Let's go.
# I am VBird
这文件共有
22
行,最底下一行为空白行!现在开始我们一个案例一个案例的来½绍吧!
.
例题一、搜寻特定字符串
搜寻特定字符串很简单吧?假设我们要从刚刚的文件当中取得
the
这个特定字符串,最简单的方式
就是这样:
[dmtsai@study ~]$
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.
那如果想要『
反向选择
』呢?也就是说,当该行没有
'the'
这个字符串时才显示在屏幕上,那就直½
使用:
[dmtsai@study ~]$
grep
-
vn 'the' regular_express.txt
你会发现,屏幕上出现的行列为除了
8,12,15,16,18
五行之外的其他行列!
½下来,如果你想要取得
不论大小写的
the
这个字符串,则:
[dmtsai@study ~]$
grep
-
in 'the'
regular_express.txt
8:I can't finish
the
test.
9:Oh!
The
soup taste good.
12:
the
symbol '*' is represented as start.
14:
The
gd software is a library for drafting programs.
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.
除了多两行
(9, 14
)
之外,第
16
行也多了一个
The
的关键词被撷取到喔!
.
例题二、利用中括号
[]
来搜寻集合字符
如果我想要搜寻
test
taste
这两个单字时,可以发现到,其实她们有共通的
't.st'
存在~这个时候,
我可以这样来搜寻: