LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1252|回复: 2

帮忙看一个语法错误

[复制链接]
发表于 2007-8-20 19:39:20 | 显示全部楼层 |阅读模式
原语句是
for i in *.xml.bz2 ; do  
    echo \#$i
    bzcat $i | grep '<title' | perl -ne 'm/<title>([^<]+)</title>/ && print $1."\n";'
done | ./quickstartindex

但是运行之后出现错误:

Bareword found where operator expected at -e line 1, near "m/<title>([^<]+)</title"
syntax error at -e line 1, near "m/<title>([^<]+)</title"
Search pattern not terminated at -e line 1.

这句话哪里错了呢,需要怎么改?
 楼主| 发表于 2007-8-20 19:56:53 | 显示全部楼层
我看了一下,bzcat $i | grep '<title'的输出结果为
    <title>Algeria/People</title>
    <title>Algeria/Government</title>
    <title>Economy of Algeria</title>
    <title>Algeria/Communications</title>
等等.错误应该是perl的语法错误,但是我不知道哪里出问题了,请教一下大家
回复 支持 反对

使用道具 举报

发表于 2007-8-22 10:52:27 | 显示全部楼层
很明显 |perl -ne '/<title>([^<]+)<\/title>/ && print $1, "\n";'


<\/title>
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表