Archive for the ‘Perl’ Category

 

Perl メモ

5月 24th, 2010

このまま更新するとまたズレルダロウナ
おpreは上手くいったっぽいけど一行Perlが変だ。。。
適当に改行してみる。

$ perl -ne “\$/=\”),(\”; while(){
if( /’([0-9a-z]+)’,'(http[^']+)’,'([^']+)’,'([^']+)’,([0-9]*),([0-9]+),’([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}:[0-9]{2}:[0-9]{2})’/ ){
print \”\$1 \$2 \$5\\n\”;
}exit;
}” 3

動いたので test.phpを
<?php
var_dump( $argv );

$ perl -ne “\$/=\”),(\”;
while(){
if( /’([0-9a-z]+)’,'(http[^']+)’,'([^']+)’,'([^']+)’,([0-9]*),([0-9]+),’([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}:[0-9]{2}:[0-9]{2})’/ ){
exec(\”php -f test.php \$1 \$2 \$5\”);}exit;}”
string(8) “test.php”
[1]=>
string(9) “128274767″
[2]=>
string(53) “http://example.com/128274767″
[3]=>
string(1) “2″
}

とやりたいことが出来た。。。

Read full article | コメントは受け付けていません。