0
我在數組中有我的數據(src_ip)。我希望這些數據作爲參數傳遞給xtractr查詢。有人可以幫助我嗎? 這是我的代碼:將Ruby變量傳遞給xtractr查詢
src_ip=Array.new
src_ip=open("/home/sakshi/Desktop/test/src_ip.txt", &:read).scan(/#<host:(.+?)>/).flatten
i=0
n=src_ip.length
while i != n
p xtractr.packets('pkt.src:src_ip[i]').sum('pkt.src','pkt.length')
i+=1
end
在這裏,我想通過陣列(src_ip)在while循環xtractr查詢(xtractr.packets ...)。我無法做到這一點。
整個陣列或在同一時間的數組中的一個條目?看起來你想從代碼片段中一次一個,但是你的問題是「我想要傳遞數組」 – nattyddubbs 2013-02-26 21:20:30