このコマンドのライブ ストリーミング出力を、while ループで実行されている行ごとの変数/接続に保存するにはどうすればよいですか? 何かのようなもの:
netvalue <-system("tcpdump -A -i eth0 port 80 | grep foo")
while(T) {
...
nvar <- netvalue + othervalue
...
}
また
In a terminal:
$ tcpdump ... | grep --line-buffered [myterm] > fifofile
Then in R:
> con = fifo("fifofile", "r")
> open(con, "r")
> con
description class mode text opened can read
"fifo" "fifo" "r" "text" "opened" "yes"
can write
"no"
> readLines(con, n = 1)
> [myterm]
.. but it only works sometimes, and often
for a limited term, when it fails always returning:
> character(0)
readLines(con, n = -1) で "-1" 引数を使用して fifofile 全体をパージすると、一貫して接続が切断されているようです!?