Perl メモ
このまま更新するとまたズレルダロウナ
お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;}" <3
で
array(4) { [0]=> string(8) "test.php" [1]=> string(9) "128274767" [2]=> string(53) "http://example.com/128274767" [3]=> string(1) "2" }
とやりたいことが出来た。。。