免费注册 查看新帖 |

Chinaunix

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

[文本处理] 求助 这段代码是什么意思? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-09-13 12:33 |只看该作者 |倒序浏览
grep "Excel output is below:" -A`grep -c "" $OUTPUTTMP` $OUTPUTTMP | sed -e "1,/^$/d" > $next_dir/iozone_results_data.txt
re=`cat $next_dir/iozone_results_data.txt`
re1=`echo "$re" | sed 's/"Writer report"/<h2>&<\/h2>/'`

论坛徽章:
15
2015年辞旧岁徽章
日期:2015-03-03 16:54:15双鱼座
日期:2015-01-15 17:29:44午马
日期:2015-01-06 17:06:51子鼠
日期:2014-11-24 10:11:13寅虎
日期:2014-08-18 07:10:55酉鸡
日期:2014-04-02 12:24:51双子座
日期:2014-04-02 12:19:44天秤座
日期:2014-03-17 11:43:36亥猪
日期:2014-03-13 08:13:51未羊
日期:2014-03-11 12:42:03白羊座
日期:2013-11-20 10:15:18CU大牛徽章
日期:2013-04-17 11:48:45
2 [报告]
发表于 2012-09-14 08:06 |只看该作者
本帖最后由 rdcwayx 于 2012-09-14 10:07 编辑

楼主你至少该找些经典的脚本来学,这种脚本走了不少弯路,还是少看为妙,小心走火入魔啊。

如果你实在要去理解,看一下帮助:

第一:
  1. man grep

  2.        -A NUM, --after-context=NUM
  3.               Print NUM  lines  of  trailing  context  after  matching  lines.
  4.               Places   a  line  containing  a  group  separator  (--)  between
  5.               contiguous groups of matches.  With the  -o  or  --only-matching
  6.               option, this has no effect and a warning is given.

  7.        -c, --count
  8.               Suppress normal output; instead print a count of matching  lines
  9.               for  each  input  file.  With the -v, --invert-match option (see
  10.               below), count non-matching lines.  (-c is specified by POSIX.)
复制代码
第二, 看看sed的替换命令 s

第三,理解一下  `   ` 里放命令的用法。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP