perl中打开管道pipeline的例举

0.

写日志,调用Apache的rotatelog处理日志的按时间另存为等情况。

my $logfile = “|/www/bin/apache/bin/rotatelogs “.$projdir.”/sshsftp_log.%Y%m%d 86400 480”;

open(LOGFILE, “”.$logfile) or die “failed to open file:$logfile.”;

1.

读取命令行的结果并做进一步处理,然后转交给perl

open(FILE, ” w -u | awk ‘NR>2’ | “) or die “failed to open cmd: w -u”; # NR>2 skip first 2 lines

while(<FILE>){

# whatever….

}

 

此条目发表在编程技术, 计算机技术分类目录。将固定链接加入收藏夹。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code