{"id":3609,"date":"2013-08-20T21:13:39","date_gmt":"2013-08-20T12:13:39","guid":{"rendered":"http:\/\/www.achiachi.net\/nikki\/?p=3609"},"modified":"2015-02-26T06:21:59","modified_gmt":"2015-02-25T21:21:59","slug":"perlcsv%e5%bd%a2%e5%bc%8f%e3%81%ae%e9%85%8d%e5%88%97%e5%a4%89%e6%95%b0%e3%81%8b%e3%82%89%e5%80%a4%e3%82%92%e6%a4%9c%e7%b4%a2%e6%8a%bd%e5%87%ba%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.achiachi.net\/nikki\/perlcsv%e5%bd%a2%e5%bc%8f%e3%81%ae%e9%85%8d%e5%88%97%e5%a4%89%e6%95%b0%e3%81%8b%e3%82%89%e5%80%a4%e3%82%92%e6%a4%9c%e7%b4%a2%e6%8a%bd%e5%87%ba%e3%81%99%e3%82%8b.html","title":{"rendered":"Perl:CSV\u5f62\u5f0f\u306e\u914d\u5217\u5909\u6570\u304b\u3089\u5024\u3092\u691c\u7d22(\u62bd\u51fa)\u3059\u308b"},"content":{"rendered":"<p>\u3000\u4ee5\u524d\u4f5c\u6210\u3057\u305f&#038;csv_load()\u3067CSV\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u8aad\u307f\u8fbc\u3093\u3060\u30c7\u30fc\u30bf\u304b\u3089\u30ad\u30fc\u30ef\u30fc\u30c9\u304c\u542b\u307e\u308c\u308b\u884c\u3092\u62bd\u51fa\u3057\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<p><strong>\u4f7f\u3044\u65b9<\/strong><br \/>\n\u30fb\u524d\u56de\u3068\u540c\u69d8\u306b\u914d\u5217\u5909\u6570\u300c@csv_line\u300d\u306b\u5bfe\u3057\u3066\u64cd\u4f5c\u3059\u308b\u306e\u3067\u3001\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u3068\u3059\u308b\u304b\u30ed\u30fc\u30ab\u30eb\u5909\u6570\u306e\u5ba3\u8a00\u3092\u3057\u3066\u4e0b\u3055\u3044\u3002<br \/>\n\u30fb\u691c\u7d22\u5bfe\u8c61\u3068\u3057\u306a\u3044\u5217\u306f\u300c@csv_search_hide\u300d\u306e\u540c\u3058\u914d\u5217\u306b\u6570\u5217\u300c-1\u300d\u3092\u30bb\u30c3\u30c8\u3057\u3066\u4e0b\u3055\u3044\u3002\u3053\u308c\u3082\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u30fb\u30ed\u30fc\u30ab\u30eb\u5909\u6570\u3068\u3057\u3066\u4e0b\u3055\u3044\u3002<br \/>\n\u30fb&#038;csv_search(\u691c\u7d22\u30ef\u30fc\u30c9,\u5358\u8a9e\u6570\u5236\u9650);<br \/>\n\u3000\u691c\u7d22\u30ef\u30fc\u30c9\u306f(\u534a\u89d2\u30fb\u5168\u89d2)\u30b9\u30da\u30fc\u30b9\u533a\u5207\u308a\u3067\u3001\u5168\u3066\u306e\u5358\u8a9e\u304c\u542b\u307e\u308c\u308b\u884c\u3092\u62bd\u51fa\u3057\u307e\u3059\u3002<br \/>\n\u3000\u5358\u8a9e\u6570\u5236\u9650\u306f3\u3068\u3059\u308c\u3070\u300c\u5358\u8a9e1 \u5358\u8a9e2 \u5358\u8a9e3 \u5358\u8a9e4\u300d\u3068\u691c\u7d22\u3057\u305f\u6642\u30014\u5358\u8a9e\u3042\u308b\u306e\u4ee5\u4e0a\u306f\u7121\u8996\u3057\u307e\u3059\u3002<br \/>\n\u30fb\u30ad\u30fc\u30ef\u30fc\u30c9\u304c\u7a7a\u5024\u306e\u6642\u306f@csv_line\u304c\u7a7a\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><strong>\u691c\u7d22\u30ef\u30fc\u30c9\u306b\u3064\u3044\u3066<\/strong><br \/>\n\u30fb\u4e00\u822c\u7684\u306a\u691c\u7d22\u30b5\u30a4\u30c8\u3068\u540c\u69d8\u306b\u5358\u8a9e\u306e\u30b9\u30da\u30fc\u30b9\u533a\u5207\u308a\u3067\u691c\u7d22\u3067\u304d\u307e\u3059\u3002<br \/>\n\u30fb\u5236\u5fa1\u6587\u5b57(\u4e0b\u8a18)\u306b\u3088\u308a AND OR NOT \u306a\u3069\u306e\u691c\u7d22\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u30fb\u30ad\u30fc\u30ef\u30fc\u30c9\u82f1\u5b57\u306f\u5c0f\u6587\u5b57\u5927\u6587\u5b57\u95a2\u4fc2\u7121\u3057\u3067\u3059\u3002<\/p>\n<p><strong>\u5236\u5fa1\u6587\u5b57<\/strong><br \/>\n\u30fb* + &#8211; &#8221; &#8216; \u30b9\u30da\u30fc\u30b9(\u5168\u534a\u89d2) \u304c\u4f7f\u3048\u307e\u3059\u3002<br \/>\n\u30fb\u300cA B C\u300d\u3068\u3059\u308b\u3068A\u3068B\u3068C\u306e\u5168\u3066\u304c\u542b\u307e\u308c\u305f\u884c\u306e\u307f\u51fa\u529b\u3057\u307e\u3059(AND)<br \/>\n\u30fb\u300cA*B*C\u300d\u3082\u540c\u4e0a\u3067\u3059<br \/>\n\u30fb\u300cA+B+C\u300d\u3068\u3059\u308b\u3068A\u3068B\u3068C\u306e\uff11\u3064\u3067\u3082\u542b\u307e\u308c\u305f\u884c\u306e\u307f\u51fa\u529b\u3057\u307e\u3059(OR)<br \/>\n\u30fb\u300c-A-B-C\u300d\u3068\u3059\u308b\u3068A\u3068B\u3068C\u306e\u5168\u3066\u304c\u542b\u307e\u308c\u306a\u3044\u884c\u306e\u307f\u51fa\u529b\u3057\u307e\u3059(NotAND)<br \/>\n  \uff08\u5b9f\u969b\u306e\u52d5\u4f5c\u306fA \u306fNotOR \u3057\u3066 B \u3068 C \u3060\u3051NotAND\u3067\u3059\uff09<br \/>\n\u30fb\u300c-A*-B*-C\u300d\u3082\u540c\u4e0a\u3067\u3059<br \/>\n\u30fb\u300c-A+-B+-C\u300d\u3068\u3059\u308b\u3068A\u3068B\u3068C\u306e\u3069\u308c\u304b\u304c\u542b\u307e\u308c\u306a\u3044\u884c\u306e\u307f\u51fa\u529b\u3057\u307e\u3059(NotOR)<br \/>\n\u203b\u30de\u30a4\u30ca\u30b9\u3092\u3064\u3051\u308b\u4f4d\u7f6e\u306f\u5358\u8a9e\u306e\u524d\u3060\u3051\u3067\u3059\u3002\u8a18\u53f7\u306e\u524d\u306b\u3064\u3051\u3066\u3082\u7121\u8996\u3055\u308c\u307e\u3059\u3002<br \/>\n\u203b\u8a18\u53f7\u306e\u524d\u5f8c\u306e\u30b9\u30da\u30fc\u30b9\u306f\u7121\u8996\u3055\u308c\u307e\u3059\u3002(\u300cA + B * &#8211; D E\u300d\u3068\u300cA+B*-D E\u300d\u306f\u540c\u3058)<br \/>\n\u30fb\u30b7\u30f3\u30b0\u30eb\u30fb\u30c0\u30d6\u30eb\u30af\u30aa\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3000\u3067\u62ec\u308b\u3068\u3001\u62ec\u3089\u308c\u305f\u4e2d\u3067 * + &#8211; \u30b9\u30da\u30fc\u30b9\u3092\u691c\u7d22\u5bfe\u8c61\u306b\u3067\u304d\u307e\u3059\u3002<br \/>\n\u300c&#8221;A A&#8221; + &#8220;***&#8221; &#8211; &#8220;&#8212;&#8220;\u300d<br \/>\n\u30fb\u307e\u305f\u30c0\u30d6\u30eb\u30af\u30aa\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u5185\u3067\u306f\u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u304c\u3001\u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u5185\u3067\u306f\u30c0\u30d6\u30eb\u30af\u30aa\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u304c\u691c\u7d22\u5bfe\u8c61\u306b\u3067\u304d\u307e\u3059\u3002<br \/>\n\u300c&#8221;&#8221;'&#8221;\u300d<br \/>\n\u203b\u30c0\u30d6\u30eb\u30af\u30aa\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3084\u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u304c\uff11\u3064\u304b\u7121\u3044\u5834\u5408\u306f\u691c\u7d22\u6587\u5b57\u3068\u3057\u3066\u51e6\u7406\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><strong>\u6ce8\u610f\u70b9<\/strong><br \/>\n\u30fb\u30ad\u30fc\u30ef\u30fc\u30c9\u304c\u7a7a\u5024\u306e\u6642\u306f@csv_line\u304c\u7a7a\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><strong>\u5099\u5fd8\u9332<\/strong><br \/>\n\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u9577\u3059\u304e\u3066\u4f55\u3092\u3084\u3063\u3066\u308b\u304b\u5fd8\u308c\u305d\u3046\u306a\u306e\u3067\u899a\u66f8<br \/>\n\u30fb\u524d\u534a\u306e\u306e\u691c\u7d22\u30ad\u30fc\u30ef\u30fc\u30c9\u306e\u6574\u9813\u3067\u306f\u30011\u6587\u5b57\u305a\u3064\u6587\u5b57\u3092\u62fe\u3044 &#8221; &#8216; * + &#8211; \u306e\u8a18\u53f7\u306b\u3088\u3063\u3066\u51e6\u7406\u3092\u5206\u5c90<br \/>\n\u30fb\u5f8c\u534a\u306f\u8a72\u5f53\u3059\u308b\u884c\u306b\u30d5\u30e9\u30b0\u3092\u7acb\u3066\u3001and or \u6bd4\u8f03\u3057\u3066\u51fa\u529b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><strong>\u30d7\u30ed\u30b0\u30e9\u30e0<\/strong><br \/>\n<code><\/p>\n<pre>\r\n#-------------------------------------------------\r\n# CSV\u5f62\u5f0f\u306e\u914d\u5217\u5909\u6570(@csv_line)\u304b\u3089\u30ad\u30fc\u30ef\u30fc\u30c9\u304c\u542b\u307e\u308c\u308b\u884c\u3092\u62bd\u51fa\u3059\u308b\u3002\r\n#-------------------------------------------------\r\nsub csv_search{\t#0=keyword 1=limit 2=mode\r\n\tmy($k)=$_[0].\" \";#\u203b\u51e6\u7406\u4e0a\u306e\u534a\u89d2\u30b9\u30da\u30fc\u30b9\u3092\u8db3\u3057\u3066\u3044\u308b\u3002\r\n\tmy($i,$j);\r\n\t#\u30ad\u30fc\u30ef\u30fc\u30c9\u62bd\u51fa\u7528\u5909\u6570\r\n\tmy($start)=0;\r\n\tmy($mode)=\"0\";\t#1=and 2=or  3=not-and 4=not-or\r\n\tmy($count)=0;\r\n\tmy($utf8_space,@keys,$utf);\r\n\t#\u30c7\u30fc\u30bf\u62bd\u51fa\u7528\u5909\u6570\r\n\tmy(@csv,@line,@index,$v);\r\n\r\n\t#- - - - - - - - - - - - - - - - - - - - -\r\n\t# \u691c\u7d22\u30ad\u30fc\u30ef\u30fc\u30c9\u306e\u6574\u9813\r\n\t#- - - - - - - - - - - - - - - - - - - - -\r\n\t$k =~ s\/\\x0D\/\/g;\t\t\t\t#\u691c\u7d22\u30ad\u30fc\u30ef\u30fc\u30c9\u3067\u4f7f\u3048\u306a\u3044\u6587\u5b57\u3092\u9664\u5916\u3059\u308b\r\n\t$k =~ s\/\\x0A\/\/g;\r\n\t$k = &csv_format_save($k);\t\t#\u2190\u691c\u7d22\u30ef\u30fc\u30c9\u3092\u30bb\u30fc\u30d6\u5f62\u5f0f\u306b\u30fb\u30fb\u914d\u5217\u5074\u3067\u9010\u6b21\u8868\u793a\u5f62\u5f0f\u306b\u5909\u63db\u3059\u308b\u3068\u6642\u9593\u304c\u304b\u304b\u308b\u305f\u3081\r\n\tutf8::decode($k);\t\t\t\t#utf8\u6642\u306b\u30ab\u30a6\u30f3\u30c8\u304c\u304a\u304b\u3057\u304f\u306a\u308b\u5bfe\u7b56\r\n\t$utf8_space=\"\u3000\";\t\t\t\t#\u305d\u306e\u307e\u307e\u3060\u3068decode\u3057\u305f\u5024\u3068\u6bd4\u8f03\u6f14\u7b97\u3067\u304d\u306a\u3044\u306e\u3067\r\n\tutf8::decode($utf8_space);\r\n\tfor ($i = 0; $i <= length($k)-1; $i++){\r\n\t\tif (substr($k,$i,1) eq '\"'){\t\t\t\t#\u30c0\u30d6\u30eb\u30af\u30aa\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u62ec\u3089\u308c\u3066\u3044\u308b\u6642\u306e\u51e6\u7406\r\n\t\t\tfor ($j = $i+1; $j <= length($k)-1; $j++){\r\n\t\t\t\tif (substr($k,$j,1) eq '\"'){\r\n\t\t\t\t\tif ($start != $i){\r\n\t\t\t\t\t\t$mode=\"1\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (substr($k,$i+1,$j-($i+1)) ne \"\"){\r\n\t\t\t\t\t\t$utf=substr($k,$i+1,$j-($i+1));\r\n\t\t\t\t\t\tutf8::encode($utf);\r\n\t\t\t\t\t\t$keys[$#keys+1]=\"$mode,$utf\";\r\n\t\t\t\t\t\t$count++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$i=$j;\r\n\t\t\t\t\t$start=$j+1;\r\n\t\t\t\t\t$mode=\"1\";\r\n\t\t\t\t\tlast;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}elsif (substr($k,$i,1) eq \"'\"){\t\t\t\t#\u30b7\u30f3\u30b0\u30eb\u30af\u30aa\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u62ec\u3089\u308c\u3066\u3044\u308b\u6642\u306e\u51e6\u7406\r\n\t\t\tfor ($j = $i+1; $j <= length($k)-1; $j++){\r\n\t\t\t\tif (substr($k,$j,1) eq \"'\"){\r\n\t\t\t\t\tif ($start != $i){\r\n\t\t\t\t\t\t$mode=\"1\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (substr($k,$i+1,$j-($i+1)) ne \"\"){\r\n\t\t\t\t\t\t$utf=substr($k,$i+1,$j-($i+1));\r\n\t\t\t\t\t\tutf8::encode($utf);\r\n\t\t\t\t\t\t$keys[$#keys+1]=\"$mode,$utf\";\r\n\t\t\t\t\t\t$count++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$i=$j;\r\n\t\t\t\t\t$start=$j+1;\r\n\t\t\t\t\t$mode=\"1\";\r\n\t\t\t\t\tlast;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}else{\t\t\t\t\t\t\t\t\t\t\t#\u62ec\u3089\u308c\u3066\u3044\u306a\u3044\u6642\u306e\u51e6\u7406\r\n\t\t\tif (substr($k,$i,1) eq \" \"){\r\n\t\t\t\tif ($start != $i){\r\n\t\t\t\t\t$utf=substr($k,$start,$i-($start));\r\n\t\t\t\t\tutf8::encode($utf);\r\n\t\t\t\t\t$keys[$#keys+1]=\"$mode,$utf\";\r\n\t\t\t\t\t$count++;\r\n\t\t\t\t\t$mode=\"1\";\r\n\t\t\t\t}\r\n\t\t\t\t$start=$i+1;\r\n\t\t\t}elsif (substr($k,$i,1) eq $utf8_space ){\t#\u5168\u89d2\u30b9\u30da\u30fc\u30b9\r\n\t\t\t\tif ($start != $i){\r\n\t\t\t\t\t$utf=substr($k,$start,$i-($start));\r\n\t\t\t\t\tutf8::encode($utf);\r\n\t\t\t\t\t$keys[$#keys+1]=\"$mode,$utf\";\r\n\t\t\t\t\t$count++;\r\n\t\t\t\t\t$mode=\"1\";\r\n\t\t\t\t}\r\n\t\t\t\t$start=$i+1;\r\n\t\t\t}elsif (substr($k,$i,1) eq \"*\"){\r\n\t\t\t\tif ($start != $i){\r\n\t\t\t\t\t$utf=substr($k,$start,$i-($start));\r\n\t\t\t\t\tutf8::encode($utf);\r\n\t\t\t\t\t$keys[$#keys+1]=\"$mode,$utf\";\r\n\t\t\t\t\t$count++;\r\n\t\t\t\t}\r\n\t\t\t\t$mode=\"1\";\r\n\t\t\t\t$start=$i+1;\r\n\t\t\t}elsif (substr($k,$i,1) eq \"+\"){\r\n\t\t\t\tif ($start != $i){\r\n\t\t\t\t\t$utf=substr($k,$start,$i-($start));\r\n\t\t\t\t\tutf8::encode($utf);\r\n\t\t\t\t\t$keys[$#keys+1]=\"$mode,$utf\";\r\n\t\t\t\t\t$count++;\r\n\t\t\t\t}\r\n\t\t\t\t$mode=\"2\";\r\n\t\t\t\t$start=$i+1;\r\n\t\t\t}elsif (substr($k,$i,1) eq \"-\"){\r\n\t\t\t\tif ($start != $i){\r\n\t\t\t\t\t$utf=substr($k,$start,$i-($start));\r\n\t\t\t\t\tutf8::encode($utf);\r\n\t\t\t\t\t$keys[$#keys+1]=\"$mode,$utf\";\r\n\t\t\t\t\t$count++;\r\n\t\t\t\t}\r\n\t\t\t\tif ($mode eq \"0\"){\r\n\t\t\t\t\tif ($#keys==-1){\r\n\t\t\t\t\t\t$mode=\"4\";\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\t$mode=\"3\";\r\n\t\t\t\t\t}\r\n\t\t\t\t}elsif ($mode eq \"2\"){\r\n\t\t\t\t\t$mode=\"4\";\r\n\t\t\t\t}else{\r\n\t\t\t\t\t$mode=\"3\";\t\t#3\u30684\u306e\u6642 \u306fNot-AND\r\n\t\t\t\t}\r\n\t\t\t\t$start=$i+1;\r\n\t\t\t}\r\n\t\t}\r\n\t\t#\u30ea\u30df\u30c3\u30bf\u30fc($_[0]\u304c0\u4ee5\u4e0a\u306e\u6b63\u6570\u306a\u3089$_[0]\u306b\u5f93\u3044\u3001\u305d\u308c\u4ee5\u5916\u306e\u6642\u306f5\u30ef\u30fc\u30c9\u3067\u7d42\u4e86)\r\n\t\tif ($_[1] > 0 ){\r\n\t\t\tif ($_[1] <= $count ){last;}\r\n\t\t}else{\r\n\t\t\tif (5 <= $count ){last;}\r\n\t\t}\r\n\t}\r\n\t#- - - - - - - - - - - - - - - - - - - - -\r\n\t#\u691c\u7d22\u975e\u5bfe\u8c61\u3092\u9664\u5916\u3057\u305f\u691c\u7d22\u7528\u306e\u914d\u5217(@line)\u3092\u4f5c\u6210\r\n\t#- - - - - - - - - - - - - - - - - - - - -\r\n\tfor ($i = 0; $i <= $#csv_line; $i++){\r\n\t\t@csv=split(\/,\/,$csv_line[$i]);\t#\u2190\u691c\u7d22\u30ef\u30fc\u30c9\u5074\u3092\u5909\u63db\u6e08\u307f\u306e\u305f\u3081csv_split\u3092\u4f7f\u7528\u3057\u3066\u306a\u3044\r\n\t\tfor ($j = 0; $j <= $#csv; $j++){\r\n\t\t\tif ($csv_search_hide[$j] != -1){\r\n\t\t\t\t$line[$i].=\"$csv[$j],\";\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t#- - - - - - - - - - - - - - - - - - - - -\r\n\t# \u62bd\u51fa\u3068\u51fa\u529b\r\n\t#- - - - - - - - - - - - - - - - - - - - -\r\n\tfor ($j = 0; $j <= $#keys; $j++){\r\n\t\t$v = $keys[$j];\r\n\t\t$v =~ s\/\\\\\/\\\\\\\\\/g;\t\t\t\t#\u6b63\u898f\u8868\u73fe\u3067\u30a8\u30e9\u30fc\u306e\u51fa\u308b\u6587\u5b57\u3092\u7f6e\u63db\u3059\u308b\u3002\r\n\t\t$v =~ s\/\\+\/\\\\+\/g;\r\n\t\t$v =~ s\/\\*\/\\\\*\/g;\r\n\t\t$v =~ s\/\\?\/\\\\?\/g;\r\n\t\t$v =~ s\/\\.\/\\\\.\/g;\r\n\t\t$v =~ s\/\\(\/\\\\(\/g;\r\n\t\t$v =~ s\/\\)\/\\\\)\/g;\r\n\t\t$v =~ s\/\\[\/\\\\[\/g;\r\n\t\t$v =~ s\/\\]\/\\\\]\/g;\r\n\t\t$v =~ s\/\\{\/\\\\{\/g;\r\n\t\t$v =~ s\/\\}\/\\\\}\/g;\r\n\t\t$v =~ s\/\\|\/\\\\|\/g;\r\n\t\t$v =~ s\/\\^\/\\\\^\/g;\r\n\t\t$v =~ s\/^[0-9]+,\/\/;\r\n\t\tif ($keys[$j] =~ \/^1,\/){\t\t#and\r\n\t\t\tfor ($i = 0; $i <= $#csv_line; $i++){\r\n\t\t\t\tif ($index[$i] == 1){\r\n\t\t\t\t\tif ($line[$i] !~ \/$v\/i){$index[$i]=-1};\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}elsif($keys[$j] =~ \/^3,\/){\t#not-and\r\n\t\t\tfor ($i = 0; $i <= $#csv_line; $i++){\r\n\t\t\t\tif ($index[$i] == 1){\r\n\t\t\t\t\tif ($line[$i] =~ \/$v\/i){$index[$i]=-1};\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}elsif($keys[$j] =~ \/^2,\/){\t#or\r\n\t\t\tfor ($i = 0; $i <= $#csv_line; $i++){\r\n\t\t\t\tif ($line[$i] =~ \/$v\/i){ $index[$i]=1 };\r\n\t\t\t}\r\n\t\t}elsif($keys[$j] =~ \/^4,\/){\t#not-or\r\n\t\t\tfor ($i = 0; $i <= $#csv_line; $i++){\r\n\t\t\t\tif ($line[$i] !~ \/$v\/i){ $index[$i]=1 };\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\tfor ($i = 0; $i <= $#csv_line; $i++){\r\n\t\t\t\tif ($line[$i] =~ \/$v\/i){ $index[$i]=1 };\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t#@csv_line\u306b\u51fa\u529b\r\n\t@line=();\r\n\tfor ($i = 0; $i <= $#csv_line; $i++){\r\n\t\tif ($index[$i] == 1){\r\n\t\t\t$line[$#line+1]=$csv_line[$i];\r\n\t\t}\r\n\t}\r\n\t@csv_line=@line;\r\n}\r\n<\/pre>\n<p><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3000\u4ee5\u524d\u4f5c\u6210\u3057\u305f&#038;csv_load()\u3067CSV\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u8aad\u307f\u8fbc\u3093\u3060\u30c7\u30fc\u30bf\u304b\u3089\u30ad\u30fc\u30ef\u30fc\u30c9\u304c\u542b\u307e\u308c\u308b\u884c\u3092\u62bd\u51fa\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[84],"tags":[93,94,92],"class_list":["post-3609","post","type-post","status-publish","format-standard","hentry","category-84","tag-cgi","tag-csv","tag-perl"],"_links":{"self":[{"href":"https:\/\/www.achiachi.net\/nikki\/wp-json\/wp\/v2\/posts\/3609","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.achiachi.net\/nikki\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.achiachi.net\/nikki\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.achiachi.net\/nikki\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.achiachi.net\/nikki\/wp-json\/wp\/v2\/comments?post=3609"}],"version-history":[{"count":2,"href":"https:\/\/www.achiachi.net\/nikki\/wp-json\/wp\/v2\/posts\/3609\/revisions"}],"predecessor-version":[{"id":3611,"href":"https:\/\/www.achiachi.net\/nikki\/wp-json\/wp\/v2\/posts\/3609\/revisions\/3611"}],"wp:attachment":[{"href":"https:\/\/www.achiachi.net\/nikki\/wp-json\/wp\/v2\/media?parent=3609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.achiachi.net\/nikki\/wp-json\/wp\/v2\/categories?post=3609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.achiachi.net\/nikki\/wp-json\/wp\/v2\/tags?post=3609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}