我在RPi3上使用Raspbian(實際上是HASSBian)。我試圖從netcat的解析輸出:爲什麼我無法將netcat的stdout傳遞給awk?
[email protected]:~ $ netcat localhost 1099 | grep -i on
01/01 22:57:29 Rx RF HouseUnit: C2 Func: On
01/01 22:57:30 Rx RF HouseUnit: B4 Func: On
01/01 22:57:31 Rx RF HouseUnit: B5 Func: On
01/01 22:57:32 Rx RF HouseUnit: B6 Func: On
01/01 22:57:40 Rx RF HouseUnit: C1 Func: On
01/01 22:57:47 Rx RF HouseUnit: C2 Func: On
01/01 22:58:03 Rx RF HouseUnit: C2 Func: On
01/01 22:58:04 Rx RF HouseUnit: C1 Func: On
,但是當我嘗試管這awk將拉出兩個領域我想我沒有得到任何輸出。它看起來像這樣:
[email protected]:~ $ netcat localhost 1099 | grep -i on | awk '{print $6,$8}'
我錯了,認爲這應該只是工作?
[email protected]:~ $ uname -a
Linux raspberrypi 4.4.38-v7+ #938 SMP Thu Dec 15 15:22:21 GMT 2016 armv7l GNU/Linux
請看看:我應該當某人回答我的問題時?](http://stackoverflow.com/help/someone-answers) – Cyrus