论坛风格切换切换到宽版
  • 848阅读
  • 7回复

[问题求助]关于grep 的问题 [复制链接]

上一主题 下一主题
离线cnstwb.
 
发帖
2149
C币
-235019
威望
398
贡献值
1
银元
-2
铜钱
4856
人人网人气币
0
只看楼主 倒序阅读 使用道具 楼主  发表于: 2009-05-01
The da.ta file for .the review questions looks like this:.

Strawberry Jam,30.0,191          婚庆
R.aspberry Jam,1216,194服务器
Blueberry J.am,96,195外贸
Str.awberry Compote,49,621.
Rasp.berry Compote,1937,6.24    美容
Blueberry compote,200.,625             汽车
Frozen Strawberri.es,1.30,1941    美容
Straw Hats,16,.2047学习

The first field is the product name., th.e second field .is the quantity on hand,域名
and the third field is the product code. The fi.eld.s are .separated by commas..

In each of t.he following questions, .write a command using "grep" and a.
regular ex.pression. The data file in all cases is named ."inventory".域名


Question 2

Display a list of all of the lines in the f.ile th.at con.tain the word "Straw".
right before. a space..


我的回答是:. g.rep  "Straw" inventory           鲜花

为什么不对呢?

评价一下你浏览此帖子的感受

精彩

感动

搞笑

开心

愤怒

无聊

灌水
离线xphf.
发帖
1952
C币
-235598
威望
347
贡献值
1
银元
-2
铜钱
4255
人人网人气币
0
只看该作者 沙发  发表于: 2010-04-13
Re:关于grep
grep "Straw "  inventory
复制代码

发帖
2033
C币
-280850
威望
375
贡献值
1
银元
-4
铜钱
4608
人人网人气币
0
只看该作者 板凳  发表于: 2010-04-13
Re:关于grep
哈哈,你没有注意那个right before a space, 就是Straw后面要有个空格。

离线yingouqlj.
发帖
2158
C币
-139181
威望
397
贡献值
1
银元
0
铜钱
4718
人人网人气币
0
只看该作者 地板  发表于: 2010-04-13
Re:关于grep


QUOTE:哈哈,你没有注意那个right before a space, 就是Straw后面要有个空格。
neves_cu 发表于 2010-03-23 09:20



    谢谢,真的是

发帖
2133
C币
-193311
威望
363
贡献值
1
银元
-2
铜钱
4686
人人网人气币
0
只看该作者 4楼 发表于: 2010-04-13
Re:关于grep
那么Display all of the lines in the file that contain "Straw" at the START of the line。

应该用 grep 的哪一个选项呢?

离线hack119.
发帖
1875
C币
-60755
威望
362
贡献值
1
银元
-1
铜钱
4278
人人网人气币
0
只看该作者 5楼 发表于: 2010-04-13
Re:关于grep
grep "^Straw"  inventory
复制代码

离线zhujing666.
发帖
2052
C币
-604827
威望
377
贡献值
2
银元
0
铜钱
4572
人人网人气币
0
只看该作者 6楼 发表于: 2010-04-13
Re:关于grep
等会我面试通过了咱们再谈待遇

离线kgod.
发帖
1981
C币
-60648
威望
357
贡献值
1
银元
-3
铜钱
4485
人人网人气币
0
只看该作者 7楼 发表于: 2010-04-13
Re:关于grep
你真厉害,比我强

快速回复
限100 字节
如果您在写长篇帖子又不马上发表,建议存为草稿
 
上一个 下一个