免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 2637 | 回复: 14
打印 上一主题 下一主题

我的bash shell下$符号不起作用啊!!!!!! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-12-30 17:31 |只看该作者 |倒序浏览
我的bash shell下$符号不起作用啊!!!!!!
为什么?

[root@erpdataserver test]# cat datafile
northwest       NW      Charles Main            3.0     .98     3       34
western         WE      Sharon Gray             5.3     .97     5       23
southwest       SW      Lewis Dalsass           2.7     .8      2       18
southern        SO      Suan Chin               5.1     .95     4       15
southeast       SE      Patricia Hemenway       4.0     .7      4       17
eastern         EA      TB Savage               4.4     .84     5       20
northeast       NE      AM Main Jr.             5.1     .94     3       13
north           NO      Margot Weber            4.5     .89     5        9
central         CT      Ann Stephens            5.7     .94     5       13
[root@erpdataserver test]# sed 's/[0-9][0-9]$/&.5/' datafile
northwest       NW      Charles Main            3.0     .98     3       34
western         WE      Sharon Gray             5.3     .97     5       23
southwest       SW      Lewis Dalsass           2.7     .8      2       18
southern        SO      Suan Chin               5.1     .95     4       15
southeast       SE      Patricia Hemenway       4.0     .7      4       17
eastern         EA      TB Savage               4.4     .84     5       20
northeast       NE      AM Main Jr.             5.1     .94     3       13
north           NO      Margot Weber            4.5     .89     5        9
central         CT      Ann Stephens            5.7     .94     5       13

论坛徽章:
0
2 [报告]
发表于 2008-12-30 17:32 |只看该作者
。。。bs 用隐形字符骗人

论坛徽章:
0
3 [报告]
发表于 2008-12-30 17:33 |只看该作者
sed 's/[0-9][0-9]$/&.5/' datafile
本来这个会在以两个数字结尾的行后加.5,是吧。
好像没反应呢

论坛徽章:
23
15-16赛季CBA联赛之吉林
日期:2017-12-21 16:39:27白羊座
日期:2014-10-27 11:14:37申猴
日期:2014-10-23 08:36:23金牛座
日期:2014-09-30 08:26:49午马
日期:2014-09-29 09:40:16射手座
日期:2014-11-25 08:56:112015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:49:0315-16赛季CBA联赛之山东
日期:2017-12-21 16:39:1915-16赛季CBA联赛之广东
日期:2016-01-19 13:33:372015亚冠之山东鲁能
日期:2015-10-13 09:39:062015亚冠之西悉尼流浪者
日期:2015-09-21 08:27:57
4 [报告]
发表于 2008-12-30 17:33 |只看该作者

回复 #1 我是DBA 的帖子

cat -A datafile

论坛徽章:
1
2015年亚洲杯之韩国
日期:2015-04-24 09:07:02
5 [报告]
发表于 2008-12-30 17:33 |只看该作者
[root@~/bash-3.2]#sed 's/[0-9][0-9]$/&.5/' data
northwest       NW      Charles Main            3.0     .98     3       34.5
western         WE      Sharon Gray             5.3     .97     5       23.5
southwest       SW      Lewis Dalsass           2.7     .8      2       18.5
southern        SO      Suan Chin               5.1     .95     4       15.5
southeast       SE      Patricia Hemenway       4.0     .7      4       17.5
eastern         EA      TB Savage               4.4     .84     5       20.5
northeast       NE      AM Main Jr.             5.1     .94     3       13.5
north           NO      Margot Weber            4.5     .89     5        9
central         CT      Ann Stephens            5.7     .94     5       13.5

好用啊

论坛徽章:
1
2015年亚洲杯之韩国
日期:2015-04-24 09:07:02
6 [报告]
发表于 2008-12-30 17:34 |只看该作者
有特殊字符?

论坛徽章:
0
7 [报告]
发表于 2008-12-30 17:35 |只看该作者
[root@erpdataserver test]# cat -A datafile
northwest^INW^ICharles Main^I^I3.0^I.98^I3^I34^M$
western^I^IWE^ISharon Gray^I^I5.3^I.97^I5^I23^M$
southwest^ISW^ILewis Dalsass^I^I2.7^I.8^I2^I18^M$
southern^ISO^ISuan Chin^I^I5.1^I.95^I4^I15^M$
southeast ^ISE^IPatricia Hemenway^I4.0^I.7^I4^I17^M$
eastern^I^IEA^ITB Savage^I^I4.4^I.84^I5^I20^M$
northeast ^INE^IAM Main Jr.^I^I5.1^I.94^I3^I13^M$
north^I^INO^IMargot Weber^I^I4.5^I.89^I5^I 9^M$
central^I^ICT ^IAnn Stephens^I^I5.7^I.94^I5^I13^M$


晕啊

论坛徽章:
0
8 [报告]
发表于 2008-12-30 17:35 |只看该作者
原帖由 nuclearxin 于 2008-12-30 17:32 发表
。。。bs 用隐形字符骗人

bs我吧,谢谢

论坛徽章:
1
2015年亚洲杯之韩国
日期:2015-04-24 09:07:02
9 [报告]
发表于 2008-12-30 17:35 |只看该作者
^M

论坛徽章:
0
10 [报告]
发表于 2008-12-30 17:37 |只看该作者
[root@erpdataserver test]# sed 's/[0-9][0-9]^M$/&.5/' datafile
.5rthwest       NW      Charles Main            3.0     .98     3       34
.5stern         WE      Sharon Gray             5.3     .97     5       23
.5uthwest       SW      Lewis Dalsass           2.7     .8      2       18
.5uthern        SO      Suan Chin               5.1     .95     4       15
.5utheast       SE      Patricia Hemenway       4.0     .7      4       17
.5stern         EA      TB Savage               4.4     .84     5       20
.5rtheast       NE      AM Main Jr.             5.1     .94     3       13
north           NO      Margot Weber            4.5     .89     5        9
.5ntral         CT      Ann Stephens            5.7     .94     5       13

为什么会这样子了?

[ 本帖最后由 我是DBA 于 2008-12-30 17:38 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP