参考:
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