Skynet

---------- ---------- 我的新 blog : liukaiyi.cublog.cn ---------- ----------

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  112 Posts :: 1 Stories :: 49 Comments :: 0 Trackbacks

参考:
  http://my.huhoo.net/archives/2007/08/perl_1.html

简单的
   echo "tt" |perl  -ne  'print $_ '
多行
   find . -type f |perl  -ne  'print $1 $_ if $_=~ /(.*)flv/'
限定行数
   find . -type f |perl  -ne  'print $_ if $_=~ /.*flv/ && $tmp++<10 && $tmp>4'
    #当然shell>> find . -type f |grep ".*flv" |sed -n '5,10p' 和上面是一样的
    # 不过 你看那  其中使用 $1 等正则重定向 ,哈哈
结果大体上
./test3/0.flv
./flvplayer.swf
./test.flv
./0.flv




perl -h
  -e program        one line of program (several -e's allowed, omit programfile)
  -n                assume "while (<>) { ... }" loop around program
  -p                assume loop like -n but print line also, like sed






整理 www.blogjava.net/Good-Game
posted on 2009-02-17 17:39 刘凯毅 阅读(1450) 评论(0)  编辑  收藏 所属分类: perl

只有注册用户登录后才能发表评论。


网站导航: