免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: Vic_Yu
打印 上一主题 下一主题

perl指定位置输出 [复制链接]

论坛徽章:
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
11 [报告]
发表于 2008-01-02 11:14 |只看该作者
原帖由 Vic_Yu 于 2008-1-2 11:11 发表


嘿嘿,按照你的意思,但是似乎我这里出错,我是在WINDOWS环境下运行perl的,错误信息:"Bad name after F' at C:\Documents and Settings....."


WINDOWS上'要换成"

perl -F"=" -lane "print $F[1] if /^aaa/" urfile

论坛徽章:
0
12 [报告]
发表于 2008-01-02 11:18 |只看该作者
用shell

  1. cut -d "=" -f2 yourfile
复制代码

论坛徽章:
0
13 [报告]
发表于 2008-01-02 11:29 |只看该作者
原帖由 ly5066113 于 2008-1-2 11:14 发表


WINDOWS上'要换成"

perl -F"=" -lane "print $F[1] if /^aaa/" urfile


似乎"F"这个东西有问题.错误信息:

String found where operator expected at C:\Documents and Settings\lyu\Desktop\Bb
\old.pl line 22, near "F"=""
String found where operator expected at C:\Documents and Settings\lyu\Desktop\Bb
\old.pl line 22, near "lane "print $F[1] if /^aaa/""
        (Do you need to predeclare lane?)
String found where operator expected at C:\Documents and Settings\lyu\Desktop\Bb
\old.pl line 22, near ""print $F[1] if /^aaa/" "C:\\Documents and Settings\\lyu\
\Desktop\\Bb\\1111.txt""
        (Missing operator before  "C:\\Documents and Settings\\lyu\\Desktop\\Bb\
\1111.txt"?)
syntax error at C:\Documents and Settings\lyu\Desktop\Bb\old.pl line 22, near "F
"=""
Execution of C:\Documents and Settings\lyu\Desktop\Bb\old.pl aborted due to comp
ilation errors.

论坛徽章:
0
14 [报告]
发表于 2008-01-02 11:33 |只看该作者
perl -F"\=" -lane "print $F[1] if /^aaa/" urfile

论坛徽章:
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
15 [报告]
发表于 2008-01-02 11:35 |只看该作者
写在脚本里了?

我这个是直接在 “命令行” 执行的啊!

论坛徽章:
0
16 [报告]
发表于 2008-01-02 11:39 |只看该作者
原帖由 alexru 于 2008-1-2 11:33 发表
perl -F"\=" -lane "print $F[1] if /^aaa/" urfile



perl -F"\=" -lane "print $F[1] if /^aaa/" 'C:\\Bb\\1111.txt'

我程序如上.还是有问题.

论坛徽章:
0
17 [报告]
发表于 2008-01-02 12:18 |只看该作者
'C:\\Bb\\1111.txt'???

直接写成 "c:/xxxx/xxxx/xxxx"
或者  "c:\\xxxx\\xxxx\\xxxx"

":" 有没有\ 我忘了  - - 汗  学到没忘的多

论坛徽章:
0
18 [报告]
发表于 2008-01-02 12:36 |只看该作者
原帖由 ly5066113 于 2008-1-2 11:35 发表
写在脚本里了?

我这个是直接在 “命令行” 执行的啊!


命令行OK,要是放到脚本里面,应该如何改变一下呢?

论坛徽章:
0
19 [报告]
发表于 2008-01-02 13:14 |只看该作者
谢谢大家,问题已经解决,继续下面的问题
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP