我有一个apache.log文件.我试图制作一个批处理文件,以便能够计算登录总量.基本上有很多行.
我最初的想法是设置一个变量results = 0,每当findstr命令得到一个结果,我得到+1变量值,最后显示值.不知道那是不是正确的思维方式.
到目前为止,我已经得到了/ f命令的印象可能是关键,虽然我从来没有使用它这么多部分我不清楚.
这是.log文件行的示例
67.195.112.96 - - [22/Feb/2010:00:06:03 +0200] "GET /www/kurpiai/dalyviai/?did=118 HTTP/1.0" 200 41119 "-" "Mozilla/5.0 (compatible; Yahoo! Slurp/3.0; http://help.yahoo.com/help/us/ysearch/slurp)"
Run Code Online (Sandbox Code Playgroud)
到目前为止,我的尝试如下:
findstr ^[1-9] apache.log
for /f %%G in ('findstr ^[1-9] apache.log') do echo result %%G
Run Code Online (Sandbox Code Playgroud)
现在我明白在这种情况下,%% G值会被每个findstr结果替换.并且通过这个,我得到了匹配findstr的每一行的回声,然后是每个ip地址.为什么?
我相信也许某种程度上我可以使用%% G值每次都改变来设置我自己的变量的事实.为什么%% G正好得到一个ip值?
或者我错了,我根本不需要这个任务的/ f?
im quite new to php and as i was looking for info for last 2 hours, no examples seemed to help. i have what i think is called nested array? two of them. pretty much i need to be able to match id from different arrays. and detract the amount from stock.
<?php
$items = array(
array('id' => 34, 'name' => 'Kompiuterius ASUS ASX89', 'price' => 639.00, 'stock' => 3),
array('id' => 1008, 'name' => 'Monitorius AOC 27IPS', 'price' => …Run Code Online (Sandbox Code Playgroud)