LinuxSir.cn,穿越时空的Linuxsir!

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

sed '/a/,/b/s'问题的延续......

[复制链接]
发表于 2004-7-7 00:06:39 | 显示全部楼层 |阅读模式
:cool: ;)

将前面解决问题代码以变量实现.
http://www.linuxsir.cn/forum.php?mod=viewthread&tid=124338
出现错误

  1. #!/bin/bash

  2. logflag=g2m
  3. logyear=2004
  4. string="<a href\=\\"game\/200403\/awstats\.game\.html\\" target\=_blank>07<\/a> \&nbsp;"
  5. file="index.html"
  6. [color=red]cat $file | sed -n '/<\!-- '$logflag' -->/,/<\!-- \/'$logflag' -->/{/'$logyear'/{s/$/'$string'/p}}'[/color]
复制代码


error:
sed: -e expression #1, char 47: Unterminated `s' command


KornLee兄能否指点一下
发表于 2004-7-7 00:11:08 | 显示全部楼层
;),这样的讨论论坛早已有之

  1. cat $file | sed -n "/<\!-- $logflag -->/,/<\!-- \/$logflag -->/{/$logyear/{s/$/$string/p}}"
复制代码


http://www.linuxsir.cn/bbs/showthread.php?threadid=123434
 楼主| 发表于 2004-7-7 00:23:39 | 显示全部楼层
呵呵!一点就醒.

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

本版积分规则

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