看书遇到关于grep指令问题

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
头像
apple1900
帖子: 31
注册时间: 2011-10-17 9:09

看书遇到关于grep指令问题

#1

帖子 apple1900 » 2011-12-20 21:23

知识点:通配符【^abc】代表一定有一个字符,只要非a,b,c的其他字符就可以
现在有一文件regular_express.txt内容如下
"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

(注:最后一行是空的)
为什么grep -n 'the' regular_express.txt 和grep -n '^the' regular_express.txt 都能搜索到
12:the symbol '*' is represented as start.??????
我是菜虫,比菜鸟还菜……
头像
shiznet
帖子: 7
注册时间: 2010-11-14 16:45

Re: 看书遇到关于grep指令问题

#2

帖子 shiznet » 2011-12-20 22:00

感觉没啥问题啊
头像
Fermat618
帖子: 728
注册时间: 2008-12-28 16:01

Re: 看书遇到关于grep指令问题

#3

帖子 Fermat618 » 2011-12-20 22:23

有方括号还是没方括号,这是个问题。
爱因斯坦会弹钢琴
爱因斯坦会拉小提琴
爱因斯坦会骑自行车
头像
msos
帖子: 148
注册时间: 2011-11-28 22:22

Re: 看书遇到关于grep指令问题

#4

帖子 msos » 2011-12-20 22:31

看不懂,来围观,留名字
头像
lilydjwg
论坛版主
帖子: 4258
注册时间: 2009-04-11 23:46
系统: Arch Linux
联系:

Re: 看书遇到关于grep指令问题

#5

帖子 lilydjwg » 2011-12-20 23:55

Fermat618 写了:有方括号还是没方括号,这是个问题。
那个叫六角括号。
头像
naturalaw
帖子: 1360
注册时间: 2011-09-06 22:04

Re: 看书遇到关于grep指令问题

#6

帖子 naturalaw » 2011-12-21 0:44

lz看點正則表達式的資料吧。
[^abc]和^abc不一樣。前面的[^abc]是排除,後面的^是行首。
  • The eternal law
头像
懒蜗牛Gentoo
论坛版主
帖子: 7362
注册时间: 2007-03-02 17:36
系统: Linux Mint

Re: 看书遇到关于grep指令问题

#7

帖子 懒蜗牛Gentoo » 2011-12-21 9:37

ls正解
虽然世上没有完美的东西,但这并不影响我们追求完美,因为只有偏执狂才TMD能成功。
10.04新手入门——笨兔兔讲述自己的故事
头像
apple1900
帖子: 31
注册时间: 2011-10-17 9:09

Re: 看书遇到关于grep指令问题

#8

帖子 apple1900 » 2011-12-21 13:28

naturalaw, 对!!!!!!!!
我看浑了,晕死我了。看到后面他有比较^在括号外面和里面是不一样的!!
我是菜虫,比菜鸟还菜……
头像
apple1900
帖子: 31
注册时间: 2011-10-17 9:09

Re: 看书遇到关于grep指令问题

#9

帖子 apple1900 » 2011-12-21 13:29

shiznet, :em20 ,我不是问了么
我是菜虫,比菜鸟还菜……
头像
apple1900
帖子: 31
注册时间: 2011-10-17 9:09

Re: 看书遇到关于grep指令问题

#10

帖子 apple1900 » 2011-12-21 13:29

Fermat618, 对!!!!!!!!
我看浑了,晕死我了。看到后面他有比较^在括号外面和里面是不一样的!!
我是菜虫,比菜鸟还菜……
头像
apple1900
帖子: 31
注册时间: 2011-10-17 9:09

Re: 看书遇到关于grep指令问题

#11

帖子 apple1900 » 2011-12-21 13:31

lilydjwg 写了:
Fermat618 写了:有方括号还是没方括号,这是个问题。
那个叫六角括号。
:em06 ,问题不在那
我是菜虫,比菜鸟还菜……
回复